[英]Find Principal end and Dependent end out of EDM model
I need to find all foreign keys using EDM model.我需要使用 EDM model 找到所有外键。 I was able to pull many useful information using Systm.Data.Entity.Core.Metadata classes and methods but still not able to get Principal and Dependent from an association or relationship.
我能够使用 Systm.Data.Entity.Core.Metadata 类和方法提取许多有用的信息,但仍然无法从关联或关系中获取 Principal 和 Dependent。
ReferentialConstraint
class has public properties FromRole
/ ToRole
, one of them is Principal and another is Dependent but I'm not sure which ones exactly. ReferentialConstraint
class 具有公共属性FromRole
/ ToRole
,其中一个是 Principal ,另一个是 Dependent 但我不确定哪些是确切的。
ReferentialConstraint
has private fields PrincipalEnd
and DependentEnd
who might help me but I woudn't like to access them via reflection. ReferentialConstraint
有私有字段PrincipalEnd
和DependentEnd
可能会帮助我,但我不想通过反射访问它们。 Is there a better way to figure out what end is Principal and what end is Dependent?有没有更好的方法来确定什么是 Principal 以及什么是 Dependent?
PS: I saw solution in this EF6 - How to determine principal/dependent sides from a NavigationProperty question but there is no proof it's 100% correct. PS:我在这个EF6 中看到了解决方案 - 如何从 NavigationProperty 问题中确定主体/依赖方,但没有证据证明它是 100% 正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.