Example #1
0
        internal static IEdmTypeReference GetCollectionItemType(this IEdmTypeReference typeReference)
        {
            IEdmCollectionTypeReference type = typeReference.AsCollectionOrNull();

            if (type != null)
            {
                return(type.ElementType());
            }
            return(null);
        }
Example #2
0
        internal static IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
        {
            IEdmCollectionTypeReference reference = typeReference.AsCollectionOrNull();

            if ((reference != null) && !typeReference.IsNonEntityODataCollectionTypeKind())
            {
                throw new ODataException(Microsoft.Data.OData.Strings.ValidationUtils_InvalidCollectionTypeReference(typeReference.TypeKind()));
            }
            return(reference);
        }
Example #3
0
        /// <summary>
        /// Validates that the <paramref name="typeReference"/> represents a collection type.
        /// </summary>
        /// <param name="typeReference">The type reference to validate.</param>
        /// <returns>The <see cref="IEdmCollectionTypeReference"/> instance representing the collection passed as <paramref name="typeReference"/>.</returns>
        internal static IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
        {
            IEdmCollectionTypeReference collectionTypeReference = typeReference.AsCollectionOrNull();

            if (collectionTypeReference != null && !typeReference.IsNonEntityCollectionType())
            {
                throw new ODataException(Strings.ValidationUtils_InvalidCollectionTypeReference(typeReference.TypeKind()));
            }

            return(collectionTypeReference);
        }
Example #4
0
 /// <summary>
 /// Validates that the <paramref name="typeReference"/> represents a collection type.
 /// </summary>
 /// <param name="typeReference">The type reference to validate.</param>
 /// <returns>The <see cref="IEdmCollectionTypeReference"/> instance representing the collection passed as <paramref name="typeReference"/>.</returns>
 public IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
 {
     return(typeReference.AsCollectionOrNull());
 }
Example #5
0
        /// <summary>
        /// Validates that the <paramref name="typeReference"/> represents a collection type.
        /// </summary>
        /// <param name="typeReference">The type reference to validate.</param>
        /// <returns>The <see cref="IEdmCollectionTypeReference"/> instance representing the collection passed as <paramref name="typeReference"/>.</returns>
        internal static IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
        {
            IEdmCollectionTypeReference collectionTypeReference = typeReference.AsCollectionOrNull();

            if (collectionTypeReference != null && !typeReference.IsNonEntityCollectionType())
            {
                throw new ODataException(Strings.ValidationUtils_InvalidCollectionTypeReference(typeReference.TypeKind()));
            }

            return collectionTypeReference;
        }
Example #6
0
 internal static IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
 {
     IEdmCollectionTypeReference reference = typeReference.AsCollectionOrNull();
     if ((reference != null) && !typeReference.IsNonEntityODataCollectionTypeKind())
     {
         throw new ODataException(Microsoft.Data.OData.Strings.ValidationUtils_InvalidCollectionTypeReference(typeReference.TypeKind()));
     }
     return reference;
 }
 /// <summary>
 /// Validates that the <paramref name="typeReference"/> represents a collection type.
 /// </summary>
 /// <param name="typeReference">The type reference to validate.</param>
 /// <returns>The <see cref="IEdmCollectionTypeReference"/> instance representing the collection passed as <paramref name="typeReference"/>.</returns>
 public IEdmCollectionTypeReference ValidateCollectionType(IEdmTypeReference typeReference)
 {
     return typeReference.AsCollectionOrNull();
 }