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


C# EdmEntityType.IsEquivalentTo方法代码示例

本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmEntityType.IsEquivalentTo方法的典型用法代码示例。如果您正苦于以下问题:C# EdmEntityType.IsEquivalentTo方法的具体用法?C# EdmEntityType.IsEquivalentTo怎么用?C# EdmEntityType.IsEquivalentTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.OData.Edm.Library.EdmEntityType的用法示例。


在下文中一共展示了EdmEntityType.IsEquivalentTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NullComparisonEquivalence

        public void NullComparisonEquivalence()
        {
            EdmEntityType entity = new EdmEntityType("Foo", "Bar", null, false, false);

            Assert.IsFalse(entity.IsEquivalentTo(null), "Type RHS");
            Assert.IsFalse(((IEdmEntityType)null).IsEquivalentTo(entity), "Type LHS");
            Assert.IsTrue(((IEdmEntityType)null).IsEquivalentTo(null), "Type Both");

            Assert.IsFalse(new EdmEntityTypeReference(entity, false).IsEquivalentTo(null), "TypeReference RHS");
            Assert.IsFalse(((IEdmEntityTypeReference)null).IsEquivalentTo(new EdmEntityTypeReference(entity, false)), "TypeReference LHS");
            Assert.IsTrue(((IEdmEntityTypeReference)null).IsEquivalentTo(null), "TypeReference Both");
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:TypeSemanticsUnitTests.cs

示例2: EqualityEntityTypeTest

        public void EqualityEntityTypeTest()
        {
            var baseEntityType = new EdmEntityType("NS", "Base", new EdmEntityType("NS", "BaseBase"), false, false);
            var differentBaseEntityType = new EdmEntityType("NS", "Base", new EdmEntityType("NS", "BaseBase"), true, false);

            var baseline = new EdmEntityType("NS", "Baseline", baseEntityType, false, false);
            baseline.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var match = new EdmEntityType("NS", "Baseline", baseEntityType, false, false);
            match.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentNamespace = new EdmEntityType("foo", "Baseline", baseEntityType, false, false);
            differentNamespace.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentName = new EdmEntityType("NS", "foo", baseEntityType, false, false);
            differentName.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentBaseType = new EdmEntityType("NS", "Baseline", differentBaseEntityType, false, false);
            differentBaseType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var nullBaseType = new EdmEntityType("NS", "Baseline", null, false, false);
            nullBaseType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentAbstract = new EdmEntityType("NS", "Baseline", baseEntityType, true, false);
            differentAbstract.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentIsOpen = new EdmEntityType("NS", "Baseline", baseEntityType, false, true);
            differentIsOpen.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));

            var differentProperties = new EdmEntityType("NS", "Baseline", baseEntityType, false, false);
            differentProperties.AddStructuralProperty("foo", EdmCoreModel.Instance.GetInt32(false));

            var differentKey = new EdmEntityType("NS", "Baseline", baseEntityType, false, false);
            var differentKeyId = differentProperties.AddStructuralProperty("id", EdmCoreModel.Instance.GetInt32(false));
            differentKey.AddKeys(differentKeyId);

            Assert.IsTrue(baseline.IsEquivalentTo(baseline), "Is the same.");
            Assert.IsFalse(baseline.IsEquivalentTo(match), "Is the same, different obj refs.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentNamespace), "Different namespace.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentName), "Different name.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentBaseType), "Different base type.");
            Assert.IsFalse(baseline.IsEquivalentTo(nullBaseType), "Null base type.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentAbstract), "Different abstract.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentIsOpen), "Different is open.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentProperties), "Different properties.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentKey), "Different key.");
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:47,代码来源:TypeSemanticsUnitTests.cs


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