当前位置: 首页>>代码示例>>C#>>正文


C# IEdmModel.FindEntityType方法代码示例

本文整理汇总了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);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:28,代码来源:NavigationParsingTests.cs

示例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.");
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:6,代码来源:NavigationParsingTests.cs

示例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);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:26,代码来源:NavigationParsingTests.cs


注:本文中的IEdmModel.FindEntityType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。