从代码优先类创建实体图
我刚刚阅读
此页面上的 Asp.net MVC3 教程(模型(数据)) 教程 4 of 10 在 ASP.NET 网站上,显示实体图是从代码优先类创建的。如何生成它们?
I was just reading Asp.net MVC3 tutorials (Models (Data))
On this page tutorial 4 of 10 on the ASP.NET website, it is shown that an entity diagram is created from code first classes. How to generate them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
通过使用类图可以非常轻松地完成此操作。添加新项目>类图。然后将代码优先类从解决方案资源管理器拖放到图表中。
This can be done very easily by using the Class Diagram. Add New Item > Class Diagram. Then drag and drop your code first classes into the diagram from the solution explorer.
类图可以,但它不会自动显示类之间的关系。我使用过的最灵活的方法是 Entity Framework Power Tools 。他们对该工具的描述:
A Class Diagram is OK, but it doesn't automatically show the relationships between classes. The slickest way that I have used is Entity Framework Power Tools. Their description of the tool:
假设您的架构是从 Code First 类创建的,您可以将数据库反转为 edmx 以可视化模型。不过,由此生成的任何类显然都不会与您的 Code First 类相关。
Assuming your schema has been created from the Code First classes you can reverse the db into a an edmx to visualise the Model. Any classes generated from this obviously won't be related to your Code First classes though.
创建您的项目的副本。打开副本并添加新项目/ADO.NET 实体数据模型。编辑布局图并打印为 .pdf 文件。删除项目的副本。
每当您进行更改时,都必须重新创建图表并编辑布局,但我通常可以在大约 15 分钟内完成整个过程。
Create a copy of your project. Open the copy and add a new item/ADO.NET Entity Data Model. Edit the diagram for layout and print to a .pdf file. Delete the copy of the project.
Anytime you make a change you will have to re-create the diagram and edit the layout, but I can usually get through the whole process in about 15 minutes.