Generating ERD diagrams within Visual Studio

database, entity-relationship, erd, visual-studio

Solution

Assuming you already have a database, you can easily generate an ERD following the steps below.

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 an entity relationship diagram. It was tested in `VS2012`

- 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.

Problem

In order to create an ERD diagram for new projects I have been using Visual Studio's entity framework designer. Essentially I'm creating a "dummy project", adding entity framework via Nuget and diagramming away (I don't use Microsoft's Entity Framework thus the dummy project). Is there another way to create such diagrams natively within Visual Studio 2010 Ultimate?

Original source

Related problems