如何从导航属性中获取最终属性名称?
在我的模型中,我有一对多的关系如下:
所以,当我拥有Team.Players
导航属性时,我想知道,在其关联的另一端,我有一个属性调用Team
。
所以,为此,首先我得到Team
类型,然后我得到它的导航属性。
EntityType myType = irrelevant.GetTypeFromContext('Team');
var TeamNavigationProperties = myType.NavigationProperties;
现在我从Navigation Property开始toEndMember,返回relationship end member:
NavigationProperty PlayersNavigationProperty = TeamNavigationProperties[0]; //Simplified code
String endMemberName = PlayersNavigationProperty.toEndMember.Name; //Which resolves to "Team_Players_Target"
是否可以从Team.Players
开始使用Player.Team
解决导航结束的问题?