public static int GetMaxLength(this TypeUsage type) {
            int value;

            if (type.TryGetMaxLength(out value)) {
                return value;
                
            }

            throw new ApplicationException("Cannot get the max length.");
        }
        /// <summary>
        ///     Determines preferred value for SQLiteParameter.Size. Returns null
        ///     where there is no preference.
        /// </summary>
        private static int?GetParameterSize(TypeUsage type, bool isOutParam)
        {
            int maxLength;

            if (type.TryGetMaxLength(out maxLength))
            {
                // if the MaxLength facet has a specific value use it
                return(maxLength);
            }

            if (isOutParam)
            {
                // if the parameter is a return/out/inout parameter, ensure there
                // is space for any value
                return(int.MaxValue);
            }

            // no value
            return(default);
        public override TypeUsage GetEdmType(TypeUsage storeType)
        {
            Throw.IfNull(storeType, "storeType");

            var storeTypeName = storeType.EdmType.Name.ToLowerInvariant();
            if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw new ArgumentException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }

            var edmPrimitiveType = base.StoreTypeNameToEdmPrimitiveType[storeTypeName];

            var maxLength = 0;
            var isUnicode = true;
            var isFixedLen = false;
            var isUnbounded = true;

            PrimitiveTypeKind newPrimitiveTypeKind;

            switch (storeTypeName)
            {
                    // for some types we just go with simple type usage with no facets
                case "tinyint":
                case "smallint":
                case "bigint":
                case "bit":
                case "uniqueidentifier":
                case "int":
                case "geography":
                case "geometry":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);

                case "varchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isUnicode = false;
                    isFixedLen = false;
                    break;

                case "char":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isUnicode = false;
                    isFixedLen = true;
                    break;

                case "nvarchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isUnicode = true;
                    isFixedLen = false;
                    break;

                case "nchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isUnicode = true;
                    isFixedLen = true;
                    break;

                case "varchar(max)":
                case "text":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = true;
                    isUnicode = false;
                    isFixedLen = false;
                    break;

                case "nvarchar(max)":
                case "ntext":
                case "xml":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = true;
                    isUnicode = true;
                    isFixedLen = false;
                    break;

                case "binary":
                    newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isFixedLen = true;
                    break;

                case "varbinary":
                    newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                    isUnbounded = !storeType.TryGetMaxLength(out maxLength);
                    isFixedLen = false;
                    break;

                case "varbinary(max)":
                case "image":
                    newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                    isUnbounded = true;
                    isFixedLen = false;
                    break;

                case "timestamp":
                case "rowversion":
                    return TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, true, 8);

                case "float":
                case "real":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);

                case "decimal":
                case "numeric":
                    {
                        byte precision;
                        byte scale;
                        if (storeType.TryGetPrecision(out precision)
                            && storeType.TryGetScale(out scale))
                        {
                            return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, precision, scale);
                        }
                        else
                        {
                            return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType);
                        }
                    }

                case "money":
                    return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 19, 4);

                case "smallmoney":
                    return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 10, 4);

                case "datetime":
                case "datetime2":
                case "smalldatetime":
                    return TypeUsage.CreateDateTimeTypeUsage(edmPrimitiveType, null);
                case "date":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);
                case "time":
                    return TypeUsage.CreateTimeTypeUsage(edmPrimitiveType, null);
                case "datetimeoffset":
                    return TypeUsage.CreateDateTimeOffsetTypeUsage(edmPrimitiveType, null);

                default:
                    throw new NotSupportedException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }

            Debug.Assert(
                newPrimitiveTypeKind == PrimitiveTypeKind.String || newPrimitiveTypeKind == PrimitiveTypeKind.Binary,
                "at this point only string and binary types should be present");

            switch (newPrimitiveTypeKind)
            {
                case PrimitiveTypeKind.String:
                    if (!isUnbounded)
                    {
                        return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen, maxLength);
                    }
                    else
                    {
                        return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen);
                    }
                case PrimitiveTypeKind.Binary:
                    if (!isUnbounded)
                    {
                        return TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen, maxLength);
                    }
                    else
                    {
                        return TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen);
                    }
                default:
                    throw new NotSupportedException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }
        }
        public override TypeUsage GetEdmType(TypeUsage storeType)
        {
            Check.NotNull(storeType, "storeType");

            var storeTypeName = storeType.EdmType.Name.ToLowerInvariant();

            if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw new ArgumentException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }

            var edmPrimitiveType = base.StoreTypeNameToEdmPrimitiveType[storeTypeName];

            var maxLength   = 0;
            var isUnicode   = true;
            var isFixedLen  = false;
            var isUnbounded = true;

            PrimitiveTypeKind newPrimitiveTypeKind;

            switch (storeTypeName)
            {
            // for some types we just go with simple type usage with no facets
            case "tinyint":
            case "smallint":
            case "bigint":
            case "bit":
            case "uniqueidentifier":
            case "int":
            case "geography":
            case "geometry":
                return(TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType));

            case "varchar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode            = false;
                isFixedLen           = false;
                break;

            case "char":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode            = false;
                isFixedLen           = true;
                break;

            case "nvarchar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode            = true;
                isFixedLen           = false;
                break;

            case "nchar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode            = true;
                isFixedLen           = true;
                break;

            case "varchar(max)":
            case "text":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = true;
                isUnicode            = false;
                isFixedLen           = false;
                break;

            case "nvarchar(max)":
            case "ntext":
            case "xml":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = true;
                isUnicode            = true;
                isFixedLen           = false;
                break;

            case "binary":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = true;
                break;

            case "varbinary":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = false;
                break;

            case "varbinary(max)":
            case "image":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = true;
                isFixedLen           = false;
                break;

            case "timestamp":
            case "rowversion":
                return(TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, true, 8));

            case "float":
            case "real":
                return(TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType));

            case "decimal":
            case "numeric":
            {
                byte precision;
                byte scale;
                if (storeType.TryGetPrecision(out precision) &&
                    storeType.TryGetScale(out scale))
                {
                    return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, precision, scale));
                }
                else
                {
                    return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType));
                }
            }

            case "money":
                return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 19, 4));

            case "smallmoney":
                return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 10, 4));

            case "datetime":
            case "datetime2":
            case "smalldatetime":
                return(TypeUsage.CreateDateTimeTypeUsage(edmPrimitiveType, null));

            case "date":
                return(TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType));

            case "time":
                return(TypeUsage.CreateTimeTypeUsage(edmPrimitiveType, null));

            case "datetimeoffset":
                return(TypeUsage.CreateDateTimeOffsetTypeUsage(edmPrimitiveType, null));

            default:
                throw new NotSupportedException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }

            Debug.Assert(
                newPrimitiveTypeKind == PrimitiveTypeKind.String || newPrimitiveTypeKind == PrimitiveTypeKind.Binary,
                "at this point only string and binary types should be present");

            switch (newPrimitiveTypeKind)
            {
            case PrimitiveTypeKind.String:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen, maxLength));
                }
                else
                {
                    return(TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen));
                }

            case PrimitiveTypeKind.Binary:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen, maxLength));
                }
                else
                {
                    return(TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen));
                }

            default:
                throw new NotSupportedException(Strings.ProviderDoesNotSupportType(storeTypeName));
            }
        }
Exemplo n.º 5
0
        private static int?GetParameterSize(TypeUsage type)
        {
            int maxLength;

            return(type.TryGetMaxLength(out maxLength) ? maxLength : default(int?));
        }
        public override TypeUsage GetEdmType(TypeUsage storeType)
        {
            ArgumentUtility.CheckNotNull("storeType", storeType);

            var storeTypeName = storeType.EdmType.Name.ToLowerInvariant();

            if (!StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw new ArgumentException(string.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
            }

            var primitiveType = StoreTypeNameToEdmPrimitiveType[storeTypeName];
            var maxLength     = 0;
            var isFixedLen    = false;
            var isUnbounded   = true;

            PrimitiveTypeKind newPrimitiveTypeKind;

            switch (storeTypeName)
            {
            case "logical":
            case "int":
            case "integer":
            case "float":
            case "double":
                return(TypeUsage.CreateDefaultTypeUsage(primitiveType));

            case "date":
            case "datetime":
                return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, null));

            case "numeric":
                byte precision;
                byte scale;

                if (storeType.TryGetPrecision(out precision) && storeType.TryGetScale(out scale))
                {
                    return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision, scale));
                }

                return(TypeUsage.CreateDecimalTypeUsage(primitiveType));

            case "currency":
                return(TypeUsage.CreateDecimalTypeUsage(primitiveType, 19, 4));

            case "varchar":
            case "binaryvarchar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = false;
                break;

            case "character":
            case "char":
            case "binarychar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = true;
                break;

            case "guid":
                newPrimitiveTypeKind = PrimitiveTypeKind.Guid;
                isUnbounded          = false;
                isFixedLen           = true;
                break;

            case "memo":
            case "binarymemo":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = true;
                isFixedLen           = false;
                break;

            case "blob":
            case "general":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = true;
                isFixedLen           = false;
                break;

            default:
                throw new NotSupportedException(string.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
            }

            switch (newPrimitiveTypeKind)
            {
            case PrimitiveTypeKind.String:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateStringTypeUsage(primitiveType, false, isFixedLen, maxLength));
                }

                return(TypeUsage.CreateStringTypeUsage(primitiveType, false, isFixedLen));

            case PrimitiveTypeKind.Binary:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateBinaryTypeUsage(primitiveType, false, maxLength));
                }

                return(TypeUsage.CreateBinaryTypeUsage(primitiveType, isFixedLen));

            case PrimitiveTypeKind.Guid:
                return(TypeUsage.CreateDefaultTypeUsage(primitiveType));

            default:
                throw new NotSupportedException(string.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
            }
        }
        /// <summary>
        /// This method takes a type and a set of facets and returns the best mapped equivalent type
        /// in EDM.
        /// </summary>
        /// <param name="storeType">A TypeUsage encapsulating a store type and a set of facets</param>
        /// <returns>A TypeUsage encapsulating an EDM type and a set of facets</returns>
        public override TypeUsage GetEdmType(TypeUsage storeType)
        {
            if (storeType == null)
            {
                throw new ArgumentNullException("storeType");
            }

            string storeTypeName = storeType.EdmType.Name.ToLowerInvariant();

            if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw new ArgumentException(String.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
            }

            PrimitiveType edmPrimitiveType = base.StoreTypeNameToEdmPrimitiveType[storeTypeName];

            int  maxLength   = 0;
            bool isUnicode   = true;
            bool isFixedLen  = false;
            bool isUnbounded = true;

            PrimitiveTypeKind newPrimitiveTypeKind;

            switch (storeTypeName)
            {
            // for some types we just go with simple type usage with no facets
            case "tinyint":
            case "smallint":
            case "bigint":
            case "bit":
            case "uniqueidentifier":
            case "int":
            case "guid":
                return(TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType));

            case "nvarchar":
            case "varchar":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = false;
                break;

            case "nchar":
            case "char":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = true;
                break;

            case "nvarchar(max)":
            case "varchar(max)":
            case "ntext":
            case "text":
                newPrimitiveTypeKind = PrimitiveTypeKind.String;
                isUnbounded          = true;
                isFixedLen           = false;
                break;

            case "binary":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = true;
                break;

            case "varbinary":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLen           = false;
                break;

            case "varbinary(max)":
            case "image":
                newPrimitiveTypeKind = PrimitiveTypeKind.Binary;
                isUnbounded          = true;
                isFixedLen           = false;
                break;

            case "float":
            case "real":
                return(TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType));

            case "decimal":
            case "numeric":
            {
                byte precision;
                byte scale;
                if (storeType.TryGetPrecision(out precision) && storeType.TryGetScale(out scale))
                {
                    return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, precision, scale));
                }
                else
                {
                    return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType));
                }
            }

            case "money":
                return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 19, 4));

            case "datetime":
                return(TypeUsage.CreateDateTimeTypeUsage(edmPrimitiveType, null));

            case "time":
                return(TypeUsage.CreateTimeTypeUsage(edmPrimitiveType, null));

            default:
                throw new NotSupportedException(String.Format("Jet does not support the type '{0}'.", storeTypeName));
            }

            Debug.Assert(newPrimitiveTypeKind == PrimitiveTypeKind.String || newPrimitiveTypeKind == PrimitiveTypeKind.Binary, "at this point only string and binary types should be present");

            switch (newPrimitiveTypeKind)
            {
            case PrimitiveTypeKind.String:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen, maxLength));
                }
                else
                {
                    return(TypeUsage.CreateStringTypeUsage(edmPrimitiveType, isUnicode, isFixedLen));
                }

            case PrimitiveTypeKind.Binary:
                if (!isUnbounded)
                {
                    return(TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen, maxLength));
                }
                else
                {
                    return(TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, isFixedLen));
                }

            default:
                throw new NotSupportedException(String.Format("Jet does not support the type '{0}'.", storeTypeName));
            }
        }
Exemplo n.º 8
0
        public override TypeUsage GetEdmType(TypeUsage storeType)
        {
            Check.NotNull <TypeUsage>(storeType, nameof(storeType));
            string lowerInvariant = storeType.EdmType.Name.ToLowerInvariant();

            if (!this.StoreTypeNameToEdmPrimitiveType.ContainsKey(lowerInvariant))
            {
                throw new ArgumentException(Strings.ProviderDoesNotSupportType((object)lowerInvariant));
            }
            PrimitiveType     primitiveType = this.StoreTypeNameToEdmPrimitiveType[lowerInvariant];
            int               maxLength     = 0;
            bool              isUnicode     = true;
            PrimitiveTypeKind primitiveTypeKind;
            bool              flag;
            bool              isFixedLength;

            switch (lowerInvariant)
            {
            case "tinyint":
            case "smallint":
            case "bigint":
            case "bit":
            case "uniqueidentifier":
            case "int":
            case "geography":
            case "geometry":
                return(TypeUsage.CreateDefaultTypeUsage((EdmType)primitiveType));

            case "varchar":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode     = false;
                isFixedLength = false;
                break;

            case "char":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode     = false;
                isFixedLength = true;
                break;

            case "nvarchar":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode     = true;
                isFixedLength = false;
                break;

            case "nchar":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isUnicode     = true;
                isFixedLength = true;
                break;

            case "varchar(max)":
            case "text":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = true;
                isUnicode     = false;
                isFixedLength = false;
                break;

            case "nvarchar(max)":
            case "ntext":
            case "xml":
                primitiveTypeKind = PrimitiveTypeKind.String;
                flag          = true;
                isUnicode     = true;
                isFixedLength = false;
                break;

            case "binary":
                primitiveTypeKind = PrimitiveTypeKind.Binary;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLength = true;
                break;

            case "varbinary":
                primitiveTypeKind = PrimitiveTypeKind.Binary;
                flag          = !storeType.TryGetMaxLength(out maxLength);
                isFixedLength = false;
                break;

            case "varbinary(max)":
            case "image":
                primitiveTypeKind = PrimitiveTypeKind.Binary;
                flag          = true;
                isFixedLength = false;
                break;

            case "timestamp":
            case "rowversion":
                return(TypeUsage.CreateBinaryTypeUsage(primitiveType, true, 8));

            case "float":
            case "real":
                return(TypeUsage.CreateDefaultTypeUsage((EdmType)primitiveType));

            case "decimal":
            case "numeric":
                byte precision;
                byte scale;
                if (storeType.TryGetPrecision(out precision) && storeType.TryGetScale(out scale))
                {
                    return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision, scale));
                }
                return(TypeUsage.CreateDecimalTypeUsage(primitiveType));

            case "money":
                return(TypeUsage.CreateDecimalTypeUsage(primitiveType, (byte)19, (byte)4));

            case "smallmoney":
                return(TypeUsage.CreateDecimalTypeUsage(primitiveType, (byte)10, (byte)4));

            case "datetime":
            case "datetime2":
            case "smalldatetime":
                return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, new byte?()));

            case "date":
                return(TypeUsage.CreateDefaultTypeUsage((EdmType)primitiveType));

            case "time":
                return(TypeUsage.CreateTimeTypeUsage(primitiveType, new byte?()));

            case "datetimeoffset":
                return(TypeUsage.CreateDateTimeOffsetTypeUsage(primitiveType, new byte?()));

            default:
                throw new NotSupportedException(Strings.ProviderDoesNotSupportType((object)lowerInvariant));
            }
            switch (primitiveTypeKind)
            {
            case PrimitiveTypeKind.Binary:
                if (!flag)
                {
                    return(TypeUsage.CreateBinaryTypeUsage(primitiveType, isFixedLength, maxLength));
                }
                return(TypeUsage.CreateBinaryTypeUsage(primitiveType, isFixedLength));

            case PrimitiveTypeKind.String:
                if (!flag)
                {
                    return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, isFixedLength, maxLength));
                }
                return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, isFixedLength));

            default:
                throw new NotSupportedException(Strings.ProviderDoesNotSupportType((object)lowerInvariant));
            }
        }