Multiple Diagrams for EDM in Entity Framework 6

The Entity Data Model (EDM) for the large database displays all the entities into a single visual designer. This makes it difficult to organize and identify entities on the designer. Visual Studio (2012/2015/2017) provides a facility to split the visual representation of an Entity Data Model into multiple diagrams.

To create a new diagram for your EDM, open the Model Browser by right clicking on the designer surface and select the Model Browser in the context menu. In the Model Browser, you will see an existing diagram for your EDM. Create a new diagram by right clicking on the Diagrams node in the Model Browser and select 'Add New Diagram', as shown below.

Entity Framework 5.0 Tutorial

This will create a new diagram. You may rename the diagram as shown below.

Entity Framework 5.0 Tutorial

Now, you can drag and drop entity types from the Model browser to the new diagram, as shown below:

Entity Framework 5.0 Tutorial

You can also move entities from an existing diagram to a new diagram without creating a new diagram first. For example, if you want to move the Teacher and Course entity types to a new diagram, then select those entities in an existing diagram, right click and select 'Move to New Diagram' from the context menu:

Entity Framework 5.0 Tutorial

It will create a new diagram and move the Teacher and Course entities to a new diagram as shown below:

Entity Framework 5.0 Tutorial

So, in this way you can create a new diagram from an existing diagram.

Include Related Entities

You can also include the related entities of a particular entity in one diagram. For example, right click on the Student entity → select 'Include Related'. The Standard and Course entities will also be included, because Student contains the reference property of Standard and Course.

Entity Framework 5.0 Tutorial

This will include related entities in the same diagram as shown below.

Entity Framework 5.0 Tutorial

Additionally, you can also move properties up or down by right clicking on the property → select Move Property → select Up/Down etc. as shown below:

Entity Framework 5.0 Tutorial

Difference between Delete Entity and Remove Entity

You can remove the entity from the diagram by right clicking on the entity and selecting 'Remove from diagram'.

Entity Framework 5.0 Tutorial

Remove from Diagram will only remove the entity from the diagram whereas 'Delete from Model' will delete the entity from the EDM and you won't be able to use that entity at all.