码迷,mamicode.com
首页 > 其他好文 > 详细

Entity Framework Tutorial Basics(41):Multiple Diagrams

时间:2016-07-07 12:48:53      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

Multiple Diagrams in Entity Framework 5.0

Visual Studio 2012 provides a facility to split the design time visual representation of the Entity Data Model. This means that you can have multiple diagrams for one Entity Data Model.

You can create a new diagram in multiple ways:

  1. Add a new diagram and drag and drop entities from Model Browser
  2. Move entities from an existing diagram to a new diagram

1. Add a new diagram and drag and drop entities from Model Browser:

You can add a new diagram by right clicking on the Diagrams node of the model browser and selecting ‘Add New Diagram‘:

技术分享

You can rename the diagram, for example: StudentDiagram to include all student related entities:

技术分享

Now, you can drag and drop Student and StudentAddress entities to this new diagram:

技术分享

2. Move entities from existing diagram to new diagram:

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

技术分享

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

技术分享

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

You can also include the related entities of a particular entity. For example, right click on Student entity → select ‘Include Related‘. Standard and Course entities will also be included, because Student has their reference property:

技术分享

This will include Standard and Course entity as shown below.

技术分享

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:

技术分享

Difference between delete and remove entity:

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

技术分享

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

Entity Framework Tutorial Basics(41):Multiple Diagrams

标签:

原文地址:http://www.cnblogs.com/purplefox2008/p/5649471.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!