Generating entity relationship diagram in Visual Studio 2015

37,907

Solution 1

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

Solution 2

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

These are the steps to generate entity relationship diagram. It was tested in 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!

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

Solution 3

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.

Share:
37,907
xAminex
Author by

xAminex

Updated on August 04, 2022

Comments

  • xAminex
    xAminex almost 2 years

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

    enter image description here

    Thanks in advance

  • xAminex
    xAminex about 8 years
    I can't find what you say
  • xAminex
    xAminex about 8 years
    No Body has a clue ? :(
  • Shukri Gashi
    Shukri Gashi about 8 years
    OK. You should do relations between tables on SQL . Then when you drag tables on the visual studio editor , editor will display relations visualy same as in diagrams on SQL editor.
  • xAminex
    xAminex about 8 years
    thanks you @shukri gashi for your answer. I did the relations between tables on SQL, but I don't have such thing called "the visual studio editor "
  • Quantium
    Quantium almost 7 years
    Simple, concise. This works perfectly for me. Not only do you get an ER diagram, but if you just create a new project you also have all the POCOs.
  • Quantium
    Quantium almost 7 years
    SQL Server Management Studio 2016 doesn't have this feature anymore.
  • Frogger
    Frogger over 4 years
    I am using SQL Server Management Studio v17.9 and it has the option to create database diagrams.
  • FoggyDay
    FoggyDay about 4 years
    SSMS 18.x also has diagramming: Object Explorer > YourDB > Database Diagrams > New Diagram
  • Tidy
    Tidy about 2 years
    Still a valid solution for VS2022