internal static bool TryGetIsUnicode(TypeUsage type, out bool isUnicode)
 {
     if (EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.String))
     {
         return(EF6MetadataHelpers.TryGetBooleanFacetValue(type, "Unicode", out isUnicode));
     }
     isUnicode = false;
     return(false);
 }
 internal static bool TryGetScale(TypeUsage type, out byte scale)
 {
     if (EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.Decimal))
     {
         return(EF6MetadataHelpers.TryGetByteFacetValue(type, "Scale", out scale));
     }
     scale = (byte)0;
     return(false);
 }
 internal static bool TryGetIsFixedLength(TypeUsage type, out bool isFixedLength)
 {
     if (EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.String) || EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.Binary))
     {
         return(EF6MetadataHelpers.TryGetBooleanFacetValue(type, "FixedLength", out isFixedLength));
     }
     isFixedLength = false;
     return(false);
 }
 internal static bool TryGetPrecision(TypeUsage type, out byte precision)
 {
     if (EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.Decimal))
     {
         return(EF6MetadataHelpers.TryGetByteFacetValue(type, "Precision", out precision));
     }
     precision = (byte)0;
     return(false);
 }
 internal static bool TryGetMaxLength(TypeUsage type, out int maxLength)
 {
     if (EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.String) || EF6MetadataHelpers.IsPrimitiveType(type, PrimitiveTypeKind.Binary))
     {
         return(EF6MetadataHelpers.TryGetIntFacetValue(type, "MaxLength", out maxLength));
     }
     maxLength = 0;
     return(false);
 }
        internal static bool IsPrimitiveType(TypeUsage type, PrimitiveTypeKind primitiveTypeKind)
        {
            PrimitiveTypeKind typeKind;

            if (EF6MetadataHelpers.TryGetPrimitiveTypeKind(type, out typeKind))
            {
                return(typeKind == primitiveTypeKind);
            }
            return(false);
        }
 internal static TypeUsage GetElementTypeUsage(TypeUsage type)
 {
     if (EF6MetadataHelpers.IsCollectionType((GlobalItem)type.EdmType))
     {
         return(((CollectionType)type.EdmType).TypeUsage);
     }
     if (EF6MetadataHelpers.IsReferenceType((GlobalItem)type.EdmType))
     {
         return(TypeUsage.CreateDefaultTypeUsage((EdmType)((RefType)type.EdmType).ElementType));
     }
     return((TypeUsage)null);
 }
        internal static TypeUsage CopyTypeUsageAndSetUnicodeFacetToFalse(TypeUsage typeUsage)
        {
            bool isFixedLength = false;
            int  maxLength     = 0;

            EF6MetadataHelpers.TryGetIsFixedLength(typeUsage, out isFixedLength);
            EF6MetadataHelpers.TryGetMaxLength(typeUsage, out maxLength);
            if (maxLength > 0)
            {
                return(TypeUsage.CreateStringTypeUsage((PrimitiveType)typeUsage.EdmType, false, isFixedLength, maxLength));
            }
            return(TypeUsage.CreateStringTypeUsage((PrimitiveType)typeUsage.EdmType, false, isFixedLength));
        }
 internal static IList <EdmProperty> GetProperties(TypeUsage typeUsage)
 {
     return(EF6MetadataHelpers.GetProperties(typeUsage.EdmType));
 }
 internal static bool IsFacetValueConstant(TypeUsage type, string facetName)
 {
     return(EF6MetadataHelpers.GetFacet((IEnumerable <FacetDescription>)((PrimitiveType)type.EdmType).FacetDescriptions, facetName).IsConstant);
 }