本文整理汇总了C#中IEdmType.IsEntityOrEntityCollectionType方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmType.IsEntityOrEntityCollectionType方法的具体用法?C# IEdmType.IsEntityOrEntityCollectionType怎么用?C# IEdmType.IsEntityOrEntityCollectionType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmType
的用法示例。
在下文中一共展示了IEdmType.IsEntityOrEntityCollectionType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TargetKindFromType
/// <summary>Determines a matching target kind from the specified type.</summary>
/// <param name="type">ResourceType of element to get kind for.</param>
/// <returns>An appropriate <see cref="RequestTargetKind"/> for the specified <paramref name="type"/>.</returns>
private static RequestTargetKind TargetKindFromType(IEdmType type)
{
Debug.Assert(type != null, "type != null");
switch (type.TypeKind)
{
case EdmTypeKind.Complex:
return RequestTargetKind.ComplexObject;
case EdmTypeKind.Entity:
return RequestTargetKind.Resource;
case EdmTypeKind.Collection:
if (type.IsEntityOrEntityCollectionType())
{
return RequestTargetKind.Resource;
}
return RequestTargetKind.Collection;
case EdmTypeKind.Enum:
return RequestTargetKind.Enum;
case EdmTypeKind.TypeDefinition:
return RequestTargetKind.Primitive;
default:
Debug.Assert(type.TypeKind == EdmTypeKind.Primitive, "typeKind == ResourceTypeKind.Primitive");
return RequestTargetKind.Primitive;
}
}
示例2: IsBindingTypeValid
/// <summary>
/// Is this a valid binding type. i.e. is this an entity, entity colleciton, or complex type.
/// </summary>
/// <param name="bindingType">the binding type</param>
/// <returns>true if this binding type is valid</returns>
public static bool IsBindingTypeValid(IEdmType bindingType)
{
return bindingType == null || bindingType.IsEntityOrEntityCollectionType() || bindingType.IsODataComplexTypeKind();
}