Friday, August 21, 2020

Creating Entity Relationship Diagrams

Here is what I did to create an Entity Relationship diagram for a project at work.

Prepare for the solution at this Stack Overflow article

Download SQL Server Data Tools (SSDT) for Visual Studio

Modify Visual Studio by adding or removing workloads and components

Follow the steps listed in the answer at the SO article. 

- Open Visual Studio

- Create a project or open an existing project (must be Visual Basic, Visual C# project, or Console Application)

- Right-click the project and choose Add -> New Item…

- Under Visual C# Items select “Data”

- Select the template “ADO.NET Entity Data Model”

- Give it a name and click “Add”

- Select “Generate from database” or “Empty model”

- If “Generate from database” selected enter connection info, choose the database objects and done!

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

- In the visual representation of the edmx file in Visual Studio, arrange the entities so that the relationships are easy to follow.

- Right click in the edmx file and choose Diagram -> Export as image. Save the image.