[英]how I can verify all the releations between tables by Entity Framework?
I am trying to build application that shows all the relations between tables 我正在尝试构建显示表之间所有关系的应用程序
one-to-one // 一对一 //
many-to-one // 多对一 //
manyto many 多对多
does there is an option to get the relation between two entities via EntityFramwrok for any exisiting database ? 是否可以通过EntityFramwrok获取任何现有数据库的两个实体之间的关系?
Thanks 谢谢
In Entity framework, you can create a .edmx file from an existing database. 在实体框架中,您可以从现有数据库中创建.edmx文件。 After creating edmx, you will get a model showing relationship between all the entities. 创建edmx之后,您将获得一个模型,显示所有实体之间的关系。
Follow the steps as given in this link- 请遵循此链接中给出的步骤-
If you need to retrieve to retrieve relationships from a generic database (of a third party application) creating an edmx on the fly, probably is not the best option. 如果您需要检索以从通用数据库(第三方应用程序的数据库)中检索关系,以动态创建edmx,则可能不是最佳选择。
The best way to retrieve relationships is to use system tables. 检索关系的最佳方法是使用系统表。
The only issue is that you won't be able to understand many to many relationships because in R-DBMS you have to use a junction table to map them (you can use an algorithm to immagine if a table is a junction table but you can't be sure). 唯一的问题是您将无法理解多对多关系,因为在R-DBMS中,您必须使用联结表来映射它们(您可以使用算法来想象表是否为联结表,但是您可以(不确定)。 By the way, you have the same issue using EF. 顺便说一句,使用EF存在相同的问题。 If you think that this could be a solution you can have a look here Know relationships between all the tables of database in SQL Server to see the query in SQL Server. 如果您认为这可能是一种解决方案,则可以在这里了解一下SQL Server中数据库的所有表之间的关系,以查看SQL Server中的查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.