/// <summary> /// Creates a <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage" /> object to describe a binary type by using the specified facet values. /// </summary> /// <returns> /// A <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage" /> object describing a binary type by using the specified facet values. /// </returns> /// <param name="primitiveType"> /// A <see cref="T:System.Data.Entity.Core.Metadata.Edm.PrimitiveType" /> for which the /// <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage" /> /// object is created. /// </param> /// <param name="isFixedLength">true to set the length of the binary type to fixed; otherwise, false.</param> /// <param name="maxLength">The maximum length of the binary type.</param> public static TypeUsage CreateBinaryTypeUsage( PrimitiveType primitiveType, bool isFixedLength, int maxLength) { Check.NotNull <PrimitiveType>(primitiveType, nameof(primitiveType)); if (primitiveType.PrimitiveTypeKind != PrimitiveTypeKind.Binary) { throw new ArgumentException(Strings.NotBinaryTypeForTypeUsage); } TypeUsage.ValidateMaxLength(maxLength); return(TypeUsage.Create((EdmType)primitiveType, new FacetValues() { MaxLength = (FacetValueContainer <int?>) new int?(maxLength), FixedLength = (FacetValueContainer <bool?>) new bool?(isFixedLength) })); }