Пример #1
0
        /// <summary>
        /// Returns whether or not the type is an entity or entity collection type.
        /// </summary>
        /// <param name="edmType">The type to check.</param>
        /// <returns>Whether or not the type is an entity or entity collection type.</returns>
        internal static bool IsEntityOrEntityCollectionType(this IEdmType edmType)
        {
            DebugUtils.CheckNoExternalCallers();
            IEdmEntityType entityType;

            return(edmType.IsEntityOrEntityCollectionType(out entityType));
        }
        /// <summary>
        /// Returns whether or not the type is an entity or entity collection type.
        /// </summary>
        /// <param name="edmType">The type to check.</param>
        /// <returns>Whether or not the type is an entity or entity collection type.</returns>
        internal static bool IsEntityOrEntityCollectionType(this IEdmType edmType)
        {
            IEdmEntityType entityType;

            return(edmType.IsEntityOrEntityCollectionType(out entityType));
        }
Пример #3
0
        /// <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;
            }
        }
Пример #4
0
 /// <summary>
 /// Is this a valid binding type. i.e. is this an entity, entity collection, 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());
 }
Пример #5
0
 /// <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();
 }