The team has been quietly working on a number of improvements to the entity designer that we would like to show off and get feedback on. This particular set of features is targeted at making modeling more productive and scalable, and models themselves more comprehensible.
We’ll start with the small, fun things, and build up to a grand finale.
1. Association Highlighting
Let’s start with this. Consider the following model:
We would like to rename the navigation properties to something meaningful, as well as the foreign keys. But which navigation property is related to which foreign key? And to which association connector?
So, now you can select an association or navigation property and find out. Here, we select the “Address.Person” navigation property, and the designer highlights the two entity types involved in the association, the association connector, the navigation property on the other side, as well as the foreign keys that hold the navigation information.
This makes it easier for us to rename things to:
2. Property Reordering
Imagine that you want to add a “Name” property to the “Property” type above. You do this and end up with a type that looks like this:
But of course, you want this new property to be the second one in the type, below “Id”. Well, now you can select this property and, for example, press Alt + Home, which will move that property to the top of the type, then on Alt + Down Arrow to move it down one slot. Here is a screenshot of the type, along with the new “Move Properties” menu:
You can now select multiple properties at the same time and move them. For example:
3. Entity Shape Coloring
Entity shape coloring allows us to visually divide a single diagram into multiple meaningful areas by color coding them. You can select one or more entities and in their property sheet, change their color, which lets us do something like this:
4. Multiple Diagrams!
But what if you just want to look at subject areas within a diagram? Say, the product catalog entities, or the sales types. In that case, you can select any number of entities and move them into a new diagram by right-clicking and selecting the new “Move to new Diagram” menu item. If we do this to our “Property” type, we’ll see it appear in a new diagram. And, if we make the model browser tool window visible, we’ll see this:
Note that we now have a new “Diagrams” folder in the model browser, and that the new diagram opens in its own tab, allowing you to have multiple windows open at once against the same model. This diagram is a little sparse. Let’s bring into it any types related to “Property” by right-clicking it and selecting “Include Related”:
Now, color the “Person” type green, then bring its related type, and see how they pick up the original type’s color:
(Note that this models is not a real-world one and only intended for visualization purposes.)
Some additional notes:
- You can also drag and drop associations, types, and entity sets from the model browser.
- You can cut or copy and paste objects from one diagram to another.
- Deleting objects from a diagram will no longer delete them from the model, but only from the diagram.
- You can delete objects from the model by using Shift+Del, right clicking and selecting “Delete from Model”, or deleting them from the model browser.
- Diagrams are stored in a child file of the edmx for new edmx files. For backwards compatibility, models created in previous versions of visual studio will keep the diagram information in the EDMX file itself. However, you can move the diagram information from the EDMX to a child file by right clicking and selecting the “Move Diagrams to Separate File” context menu.
We look forward to your feedback!