SQL 在 Visual Studio 2015 中生成实体关系图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36531682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:32:57  来源:igfitidea点击:

Generating entity relationship diagram in Visual Studio 2015

sqldatabasevisual-studiovisual-studio-2015entity-relationship

提问by xAminex

Can you tell me how I can generate an ER diagram for my database1 (see below) created with VS 2015

你能告诉我如何为我用 VS 2015 创建的 database1(见下文)生成 ER 图吗?

enter image description here

在此处输入图片说明

Thanks in advance

提前致谢

采纳答案by Shukri Gashi

DB Objects in the editor will be related as in Diagram so Just relate objects in the Db and drag to editor.

编辑器中的 DB 对象将与图表中的一样关联,因此只需关联 Db 中的对象并拖动到编辑器即可。

回答by user3402754

Ensure you installed either Microsoft SQL Server Data Tools or Microsoft Web Developer Tools in order to get the Entity Data Model Designer.

确保您安装了 Microsoft SQL Server Data Tools 或 Microsoft Web Developer Tools 以获取实体数据模型设计器。

These are the steps to generate entity relationship diagram. It was tested in VS2012

这些是生成实体关系图的步骤。它被测试在VS2012

  1. Open Visual Studio
  2. Create a project or open an existing project (must be Visual Basic, Visual C# project, or Console Application)
  3. Right-click the project and choose Add-> New Item…
  4. Under Visual C# Items select “Data”
  5. Select the template “ADO.NET Entity Data Model”
  6. Give it a name and click “Add”
  7. Select “Generate from database”or “Empty model”
  8. If “Generate from database”selected enter connection info, choose the database objects and done!
  1. 打开 Visual Studio
  2. 创建项目或打开现有项目(必须是 Visual Basic、Visual C# 项目或控制台应用程序)
  3. 右键单击项目并选择Add->New Item…
  4. 在 Visual C# 项下选择 “Data”
  5. 选择模板 “ADO.NET Entity Data Model”
  6. 给它一个名字并点击 “Add”
  7. 选择“Generate from database”“Empty model”
  8. 如果“Generate from database”选择输入连接信息,选择数据库对象并完成!

The model is stored as a “.edmx”file.

模型存储为“.edmx”文件。

回答by Ghaag

With Visual Studio you can create a static diagram (class diagram)but not entity relationship diagrams (for you DB). You will have to use another tool for this. For SQL server you can use SQL server Management Studio.

使用 Visual Studio,您可以创建静态图(类图),但不能创建实体关系图(对于您的 DB)。为此,您将不得不使用其他工具。对于 SQL 服务器,您可以使用 SQL 服务器管理工​​作室