本文整理汇总了C#中IEdmModel.FindEntityType方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.FindEntityType方法的具体用法?C# IEdmModel.FindEntityType怎么用?C# IEdmModel.FindEntityType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.FindEntityType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckNavigationWithMultiplicityContainmentEnd
private void CheckNavigationWithMultiplicityContainmentEnd(IEdmModel model, EdmMultiplicity multiplicity)
{
this.CheckEntityTypeNavigationCount(model, "NS.Person", 3);
this.CheckEntityTypeNavigationCount(model, "NS.Pet", 3);
var personNavigations = model.FindEntityType("NS.Person").NavigationProperties();
var petNavigations = model.FindEntityType("NS.Pet").NavigationProperties();
var personToOnePet = personNavigations.Where(n => n.Name.Equals("ToOnePet")).First();
this.CheckNavigationContainment(personToOnePet, true, false);
this.CheckNavigationMultiplicity(personToOnePet, multiplicity, EdmMultiplicity.One);
var personToZeroOrOnePet = personNavigations.Where(n => n.Name.Equals("ToZeroOrOnePet")).First();
this.CheckNavigationContainment(personToZeroOrOnePet, true, false);
this.CheckNavigationMultiplicity(personToZeroOrOnePet, multiplicity, EdmMultiplicity.ZeroOrOne);
var personToManyPet = personNavigations.Where(n => n.Name.Equals("ToManyPet")).First();
this.CheckNavigationContainment(personToManyPet, true, false);
this.CheckNavigationMultiplicity(personToManyPet, multiplicity, EdmMultiplicity.Many);
var onePetToPerson = petNavigations.Where(n => n.Name.Equals("OnePetToPerson")).First();
Assert.AreEqual(personToOnePet.Partner, onePetToPerson, "Invalid navigation partner.");
var zeroOrOnePetToPerson = petNavigations.Where(n => n.Name.Equals("ZeroOrOnePetToPerson")).First();
this.CheckNavigationsArePartners(personToZeroOrOnePet, zeroOrOnePetToPerson);
var manyPetToPerson = petNavigations.Where(n => n.Name.Equals("ManyPetToPerson")).First();
this.CheckNavigationsArePartners(personToManyPet, manyPetToPerson);
}
示例2: CheckEntityTypeNavigationCount
private void CheckEntityTypeNavigationCount(IEdmModel model, string entityTypeFullName, int navigationPropertiesCount)
{
var entityType = model.FindEntityType(entityTypeFullName);
var navigations = entityType.NavigationProperties();
Assert.AreEqual(navigationPropertiesCount, navigations.Count(), "Invalid navigation property count.");
}
示例3: CheckNavigationWithMultiplicityRecursiveContainmentEnd
private void CheckNavigationWithMultiplicityRecursiveContainmentEnd(IEdmModel model, EdmMultiplicity multiplicity)
{
this.CheckEntityTypeNavigationCount(model, "NS.Person", 6);
var personNavigations = model.FindEntityType("NS.Person").NavigationProperties();
var manyFriendToPerson = personNavigations.Where(n => n.Name.Equals("ManyFriendToPerson")).First();
this.CheckNavigationContainment(manyFriendToPerson, false, true);
this.CheckNavigationMultiplicity(manyFriendToPerson, EdmMultiplicity.Many, multiplicity);
var zeroOrOneFriendToPerson = personNavigations.Where(n => n.Name.Equals("ZeroOrOneFriendToPerson")).First();
this.CheckNavigationContainment(zeroOrOneFriendToPerson, false, true);
this.CheckNavigationMultiplicity(zeroOrOneFriendToPerson, EdmMultiplicity.ZeroOrOne, multiplicity);
var oneFriendToPerson = personNavigations.Where(n => n.Name.Equals("OneFriendToPerson")).First();
this.CheckNavigationContainment(oneFriendToPerson, false, true);
this.CheckNavigationMultiplicity(oneFriendToPerson, EdmMultiplicity.One, multiplicity);
var toManyFriend = personNavigations.Where(n => n.Name.Equals("ToManyFriend")).First();
this.CheckNavigationsArePartners(manyFriendToPerson, toManyFriend);
var toZeroOrOneFriend = personNavigations.Where(n => n.Name.Equals("ToZeroOrOneFriend")).First();
this.CheckNavigationsArePartners(zeroOrOneFriendToPerson, toZeroOrOneFriend);
var toOneFriend = personNavigations.Where(n => n.Name.Equals("ToOneFriend")).First();
this.CheckNavigationsArePartners(oneFriendToPerson, toOneFriend);
}