本文整理汇总了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");
}
示例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.");
}