private static TypeUsage GetTypeUsage(EdmType edmType, SimpleTypeDescriptor simpleTypeDescriptor) { if (edmType.BuiltInTypeKind == BuiltInTypeKind.PrimitiveType) { PrimitiveType primitiveType = (PrimitiveType)edmType; switch (primitiveType.PrimitiveTypeKind) { case PrimitiveTypeKind.Binary: return(simpleTypeDescriptor.Length.HasValue && simpleTypeDescriptor.Length.Value >= 0 ? TypeUsage.CreateBinaryTypeUsage(primitiveType, simpleTypeDescriptor.IsFixedLength.HasValue && simpleTypeDescriptor.IsFixedLength.Value, simpleTypeDescriptor.Length.Value) : simpleTypeDescriptor.IsFixedLength.HasValue?TypeUsage.CreateBinaryTypeUsage(primitiveType, simpleTypeDescriptor.IsFixedLength.Value) : TypeUsage.CreateDefaultTypeUsage(primitiveType)); case PrimitiveTypeKind.String: return(simpleTypeDescriptor.Length.HasValue && simpleTypeDescriptor.Length.Value >= 0 ? TypeUsage.CreateStringTypeUsage(primitiveType, true, simpleTypeDescriptor.IsFixedLength.HasValue && simpleTypeDescriptor.IsFixedLength.Value, simpleTypeDescriptor.Length.Value) : simpleTypeDescriptor.IsFixedLength.HasValue?TypeUsage.CreateStringTypeUsage(primitiveType, true, simpleTypeDescriptor.IsFixedLength.Value) : TypeUsage.CreateDefaultTypeUsage(primitiveType)); case PrimitiveTypeKind.Decimal: return(simpleTypeDescriptor.Precision.HasValue && simpleTypeDescriptor.Scale.HasValue ? TypeUsage.CreateDecimalTypeUsage(primitiveType, simpleTypeDescriptor.Precision.Value, simpleTypeDescriptor.Scale.Value) : TypeUsage.CreateDefaultTypeUsage(primitiveType)); case PrimitiveTypeKind.DateTimeOffset: return(TypeUsage.CreateDateTimeOffsetTypeUsage(primitiveType, simpleTypeDescriptor.Precision)); case PrimitiveTypeKind.Time: return(TypeUsage.CreateTimeTypeUsage(primitiveType, simpleTypeDescriptor.Precision)); } } return(TypeUsage.CreateDefaultTypeUsage(edmType)); }
public void GetStoreType_returns_correct_type_usages_for_specific_DateTimeOffset_type_usages() { TypeUsageVerificationHelper.VerifyTypeUsagesEquivalent( LegacyProviderManifest.GetStoreType( LegacyMetadata.TypeUsage.CreateDateTimeOffsetTypeUsage(LegacyEdmPrimitiveTypes["DateTimeOffset"], precision: null)), ProviderManifestWrapper.GetStoreType( TypeUsage.CreateDateTimeOffsetTypeUsage(EdmPrimitiveTypes["DateTimeOffset"], precision: null))); TypeUsageVerificationHelper.VerifyTypeUsagesEquivalent( LegacyProviderManifest.GetStoreType( LegacyMetadata.TypeUsage.CreateDateTimeOffsetTypeUsage(LegacyEdmPrimitiveTypes["DateTimeOffset"], precision: 6)), ProviderManifestWrapper.GetStoreType( TypeUsage.CreateDateTimeOffsetTypeUsage(EdmPrimitiveTypes["DateTimeOffset"], precision: 6))); }
public override TypeUsage GetStoreType(TypeUsage edmType) { if (edmType == null) { throw new ArgumentNullException("edmType"); } PrimitiveType primitiveType = edmType.EdmType as PrimitiveType; if (primitiveType == null) { throw new ArgumentException("Store does not support specified edm type"); } // TODO: come up with way to determin if unicode is used bool isUnicode = true; Facet facet; switch (primitiveType.PrimitiveTypeKind) { case PrimitiveTypeKind.Boolean: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["bool"])); case PrimitiveTypeKind.Int16: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int2"])); case PrimitiveTypeKind.Int32: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int4"])); case PrimitiveTypeKind.Int64: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int8"])); case PrimitiveTypeKind.Single: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["float4"])); case PrimitiveTypeKind.Double: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["float8"])); case PrimitiveTypeKind.Decimal: { byte scale; byte precision; if (edmType.Facets.TryGetValue(ScaleFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { scale = (byte)facet.Value; if (edmType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { precision = (byte)facet.Value; return(TypeUsage.CreateDecimalTypeUsage(StoreTypeNameToStorePrimitiveType["numeric"], precision, scale)); } } return(TypeUsage.CreateDecimalTypeUsage(StoreTypeNameToStorePrimitiveType["numeric"])); } case PrimitiveTypeKind.String: { // TODO: could get character, character varying, text if (edmType.Facets.TryGetValue(FixedLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null && (bool)facet.Value) { PrimitiveType characterPrimitive = StoreTypeNameToStorePrimitiveType["bpchar"]; if (edmType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateStringTypeUsage(characterPrimitive, isUnicode, true, (int)facet.Value)); } // this may not work well return(TypeUsage.CreateStringTypeUsage(characterPrimitive, isUnicode, true)); } if (edmType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar"], isUnicode, false, (int)facet.Value)); } // assume text since it is not fixed length and has no max length return(TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["text"], isUnicode, false)); } case PrimitiveTypeKind.DateTime: if (edmType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateDateTimeTypeUsage(StoreTypeNameToStorePrimitiveType["timestamp"], (byte)facet.Value)); } else { return(TypeUsage.CreateDateTimeTypeUsage(StoreTypeNameToStorePrimitiveType["timestamp"], null)); } case PrimitiveTypeKind.DateTimeOffset: if (edmType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateDateTimeOffsetTypeUsage(StoreTypeNameToStorePrimitiveType["timestamptz"], (byte)facet.Value)); } else { return(TypeUsage.CreateDateTimeOffsetTypeUsage(StoreTypeNameToStorePrimitiveType["timestamptz"], null)); } case PrimitiveTypeKind.Time: if (edmType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateTimeTypeUsage(StoreTypeNameToStorePrimitiveType["interval"], (byte)facet.Value)); } else { return(TypeUsage.CreateTimeTypeUsage(StoreTypeNameToStorePrimitiveType["interval"], null)); } case PrimitiveTypeKind.Binary: { if (edmType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["bytea"], false, (int)facet.Value)); } return(TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["bytea"], false)); } case PrimitiveTypeKind.Guid: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["uuid"])); case PrimitiveTypeKind.Byte: case PrimitiveTypeKind.SByte: return(TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int2"])); } throw new NotSupportedException("Not supported edm type: " + edmType); }
public override TypeUsage GetEdmType(TypeUsage storeType) { if (storeType == null) { throw new ArgumentNullException("storeType"); } string storeTypeName = storeType.EdmType.Name; PrimitiveType primitiveType = StoreTypeNameToEdmPrimitiveType[storeTypeName]; // TODO: come up with way to determin if unicode is used bool isUnicode = true; Facet facet; switch (storeTypeName) { case "bool": case "int2": case "int4": case "int8": case "float4": case "float8": case "uuid": return(TypeUsage.CreateDefaultTypeUsage(primitiveType)); case "numeric": { byte scale; byte precision; if (storeType.Facets.TryGetValue(ScaleFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { scale = (byte)facet.Value; if (storeType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { precision = (byte)facet.Value; return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision, scale)); } } return(TypeUsage.CreateDecimalTypeUsage(primitiveType)); } case "bpchar": if (storeType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, true, (int)facet.Value)); } else { return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, true)); } case "varchar": if (storeType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false, (int)facet.Value)); } else { return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false)); } case "text": case "xml": return(TypeUsage.CreateStringTypeUsage(primitiveType, isUnicode, false)); case "timestamp": // TODO: make sure the arguments are correct here if (storeType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, (byte)facet.Value)); } else { return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, null)); } case "date": return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, 0)); case "timestamptz": if (storeType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateDateTimeOffsetTypeUsage(primitiveType, (byte)facet.Value)); } else { return(TypeUsage.CreateDateTimeOffsetTypeUsage(primitiveType, null)); } case "time": case "interval": if (storeType.Facets.TryGetValue(PrecisionFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateTimeTypeUsage(primitiveType, (byte)facet.Value)); } else { return(TypeUsage.CreateTimeTypeUsage(primitiveType, null)); } case "bytea": { if (storeType.Facets.TryGetValue(MaxLengthFacet, false, out facet) && !facet.IsUnbounded && facet.Value != null) { return(TypeUsage.CreateBinaryTypeUsage(primitiveType, false, (int)facet.Value)); } return(TypeUsage.CreateBinaryTypeUsage(primitiveType, false)); } case "rowversion": { return(TypeUsage.CreateBinaryTypeUsage(primitiveType, true, 8)); } //TypeUsage.CreateBinaryTypeUsage //TypeUsage.CreateDateTimeTypeUsage //TypeUsage.CreateDecimalTypeUsage //TypeUsage.CreateStringTypeUsage } throw new NotSupportedException("Not supported store type: " + storeTypeName); }
private TypeUsage BuildTypeUsage() { var primitiveType = PrimitiveType.GetEdmPrimitiveType(Type); if (Type == PrimitiveTypeKind.Binary) { if (MaxLength != null) { return(TypeUsage.CreateBinaryTypeUsage( primitiveType, IsFixedLength ?? false, MaxLength.Value)); } return(TypeUsage.CreateBinaryTypeUsage( primitiveType, IsFixedLength ?? false)); } if (Type == PrimitiveTypeKind.String) { if (MaxLength != null) { return(TypeUsage.CreateStringTypeUsage( primitiveType, IsUnicode ?? true, IsFixedLength ?? false, MaxLength.Value)); } return(TypeUsage.CreateStringTypeUsage( primitiveType, IsUnicode ?? true, IsFixedLength ?? false)); } if (Type == PrimitiveTypeKind.DateTime) { return(TypeUsage.CreateDateTimeTypeUsage(primitiveType, Precision)); } if (Type == PrimitiveTypeKind.DateTimeOffset) { return(TypeUsage.CreateDateTimeOffsetTypeUsage(primitiveType, Precision)); } if (Type == PrimitiveTypeKind.Decimal) { if ((Precision != null) || (Scale != null)) { return(TypeUsage.CreateDecimalTypeUsage( primitiveType, Precision ?? 18, Scale ?? 0)); } return(TypeUsage.CreateDecimalTypeUsage(primitiveType)); } return((Type == PrimitiveTypeKind.Time) ? TypeUsage.CreateTimeTypeUsage(primitiveType, Precision) : TypeUsage.CreateDefaultTypeUsage(primitiveType)); }
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)); } }
private static TypeUsage ConvertTypeUsage(TypeUsage original, PrimitiveType goal) { byte precision; byte scale; bool isUnicode; bool isFixed; int maxLength; switch (goal.PrimitiveTypeKind) { case PrimitiveTypeKind.DateTime: if (!TypeUsageHelper.TryGetPrecision(original, out precision)) { precision = 7; } return(TypeUsage.CreateDateTimeTypeUsage(goal, precision)); case PrimitiveTypeKind.DateTimeOffset: if (!TypeUsageHelper.TryGetPrecision(original, out precision)) { precision = 7; } return(TypeUsage.CreateDateTimeOffsetTypeUsage(goal, precision)); case PrimitiveTypeKind.Time: if (!TypeUsageHelper.TryGetPrecision(original, out precision)) { precision = 7; } return(TypeUsage.CreateTimeTypeUsage(goal, precision)); case PrimitiveTypeKind.Decimal: if (!TypeUsageHelper.TryGetPrecision(original, out precision)) { precision = 18; } if (!TypeUsageHelper.TryGetScale(original, out scale)) { scale = 0; } return(TypeUsage.CreateDecimalTypeUsage(goal, precision, scale)); case PrimitiveTypeKind.Binary: if (!TypeUsageHelper.TryGetIsFixedLength(original, out isFixed)) { isFixed = false; } if (TypeUsageHelper.TryGetMaxLength(original, out maxLength)) { return(TypeUsage.CreateBinaryTypeUsage(goal, isFixed, maxLength)); } else { return(TypeUsage.CreateBinaryTypeUsage(goal, isFixed)); } case PrimitiveTypeKind.String: if (!TypeUsageHelper.TryGetIsFixedLength(original, out isFixed)) { isFixed = false; } if (!TypeUsageHelper.TryGetIsUnicode(original, out isUnicode)) { isUnicode = true; } if (TypeUsageHelper.TryGetMaxLength(original, out maxLength)) { return (TypeUsage.CreateStringTypeUsage( goal, isUnicode, isFixed, maxLength)); } else { return (TypeUsage.CreateStringTypeUsage( goal, isUnicode, isFixed)); } } return(TypeUsage.CreateDefaultTypeUsage(goal)); }
private TypeUsage BuildTypeUsage() { PrimitiveType edmPrimitiveType = PrimitiveType.GetEdmPrimitiveType(this.Type); if (this.Type == PrimitiveTypeKind.Binary) { if (this.MaxLength.HasValue) { PrimitiveType primitiveType = edmPrimitiveType; bool? isFixedLength = this.IsFixedLength; int num = isFixedLength.HasValue ? (isFixedLength.GetValueOrDefault() ? 1 : 0) : 0; int maxLength = this.MaxLength.Value; return(TypeUsage.CreateBinaryTypeUsage(primitiveType, num != 0, maxLength)); } PrimitiveType primitiveType1 = edmPrimitiveType; bool? isFixedLength1 = this.IsFixedLength; int num1 = isFixedLength1.HasValue ? (isFixedLength1.GetValueOrDefault() ? 1 : 0) : 0; return(TypeUsage.CreateBinaryTypeUsage(primitiveType1, num1 != 0)); } if (this.Type == PrimitiveTypeKind.String) { if (this.MaxLength.HasValue) { PrimitiveType primitiveType = edmPrimitiveType; bool? isUnicode = this.IsUnicode; int num1 = isUnicode.HasValue ? (isUnicode.GetValueOrDefault() ? 1 : 0) : 1; bool? isFixedLength = this.IsFixedLength; int num2 = isFixedLength.HasValue ? (isFixedLength.GetValueOrDefault() ? 1 : 0) : 0; int maxLength = this.MaxLength.Value; return(TypeUsage.CreateStringTypeUsage(primitiveType, num1 != 0, num2 != 0, maxLength)); } PrimitiveType primitiveType1 = edmPrimitiveType; bool? isUnicode1 = this.IsUnicode; int num3 = isUnicode1.HasValue ? (isUnicode1.GetValueOrDefault() ? 1 : 0) : 1; bool? isFixedLength1 = this.IsFixedLength; int num4 = isFixedLength1.HasValue ? (isFixedLength1.GetValueOrDefault() ? 1 : 0) : 0; return(TypeUsage.CreateStringTypeUsage(primitiveType1, num3 != 0, num4 != 0)); } if (this.Type == PrimitiveTypeKind.DateTime) { return(TypeUsage.CreateDateTimeTypeUsage(edmPrimitiveType, this.Precision)); } if (this.Type == PrimitiveTypeKind.DateTimeOffset) { return(TypeUsage.CreateDateTimeOffsetTypeUsage(edmPrimitiveType, this.Precision)); } if (this.Type == PrimitiveTypeKind.Decimal) { byte?precision1 = this.Precision; if (!(precision1.HasValue ? new int?((int)precision1.GetValueOrDefault()) : new int?()).HasValue) { byte?scale = this.Scale; if (!(scale.HasValue ? new int?((int)scale.GetValueOrDefault()) : new int?()).HasValue) { return(TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType)); } } PrimitiveType primitiveType = edmPrimitiveType; byte? precision2 = this.Precision; int num1 = precision2.HasValue ? (int)precision2.GetValueOrDefault() : 18; byte? scale1 = this.Scale; int num2 = scale1.HasValue ? (int)scale1.GetValueOrDefault() : 0; return(TypeUsage.CreateDecimalTypeUsage(primitiveType, (byte)num1, (byte)num2)); } if (this.Type != PrimitiveTypeKind.Time) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)edmPrimitiveType)); } return(TypeUsage.CreateTimeTypeUsage(edmPrimitiveType, this.Precision)); }
private TypeUsage ConvertFromLegacyStoreTypeUsage(LegacyMetadata.TypeUsage legacyStoreTypeUsage) { Debug.Assert(legacyStoreTypeUsage != null, "legacyStoreTypeUsage != null"); Debug.Assert(legacyStoreTypeUsage.EdmType is LegacyMetadata.PrimitiveType, "primitive type expected"); Debug.Assert( (LegacyMetadata.DataSpace) typeof(LegacyMetadata.EdmType) .GetProperty("DataSpace", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(legacyStoreTypeUsage.EdmType) == LegacyMetadata.DataSpace.SSpace, "Expected SSpace type."); var legacyStorePrimitiveType = (LegacyMetadata.PrimitiveType)legacyStoreTypeUsage.EdmType; var storePrimitiveType = _storeTypes.Single(t => t.FullName == legacyStorePrimitiveType.FullName); switch (storePrimitiveType.PrimitiveTypeKind) { case PrimitiveTypeKind.Boolean: case PrimitiveTypeKind.Byte: case PrimitiveTypeKind.SByte: case PrimitiveTypeKind.Int16: case PrimitiveTypeKind.Int32: case PrimitiveTypeKind.Int64: case PrimitiveTypeKind.Guid: case PrimitiveTypeKind.Double: case PrimitiveTypeKind.Single: case PrimitiveTypeKind.HierarchyId: case PrimitiveTypeKind.Geography: case PrimitiveTypeKind.GeographyPoint: case PrimitiveTypeKind.GeographyLineString: case PrimitiveTypeKind.GeographyPolygon: case PrimitiveTypeKind.GeographyMultiPoint: case PrimitiveTypeKind.GeographyMultiLineString: case PrimitiveTypeKind.GeographyMultiPolygon: case PrimitiveTypeKind.GeographyCollection: case PrimitiveTypeKind.Geometry: case PrimitiveTypeKind.GeometryPoint: case PrimitiveTypeKind.GeometryLineString: case PrimitiveTypeKind.GeometryPolygon: case PrimitiveTypeKind.GeometryMultiPoint: case PrimitiveTypeKind.GeometryMultiLineString: case PrimitiveTypeKind.GeometryMultiPolygon: case PrimitiveTypeKind.GeometryCollection: return(TypeUsage.CreateDefaultTypeUsage(storePrimitiveType)); case PrimitiveTypeKind.Decimal: return(TypeUsage.CreateDecimalTypeUsage( storePrimitiveType, (byte)legacyStoreTypeUsage.Facets[PrecisionFacetName].Value, (byte)legacyStoreTypeUsage.Facets[ScaleFacetName].Value)); case PrimitiveTypeKind.Binary: return(TypeUsage.CreateBinaryTypeUsage( storePrimitiveType, (bool)legacyStoreTypeUsage.Facets[FixedLengthFacetName].Value, (int)legacyStoreTypeUsage.Facets[MaxLengthFacetName].Value)); case PrimitiveTypeKind.DateTime: return(TypeUsage.CreateDateTimeTypeUsage( storePrimitiveType, (byte?)legacyStoreTypeUsage.Facets[PrecisionFacetName].Value)); case PrimitiveTypeKind.DateTimeOffset: return(TypeUsage.CreateDateTimeOffsetTypeUsage( storePrimitiveType, (byte?)legacyStoreTypeUsage.Facets[PrecisionFacetName].Value)); case PrimitiveTypeKind.Time: return(TypeUsage.CreateTimeTypeUsage( storePrimitiveType, (byte?)legacyStoreTypeUsage.Facets[PrecisionFacetName].Value)); case PrimitiveTypeKind.String: return(TypeUsage.CreateStringTypeUsage( storePrimitiveType, (bool)legacyStoreTypeUsage.Facets[UnicodeFacetName].Value, (bool)legacyStoreTypeUsage.Facets[FixedLengthFacetName].Value, (int)legacyStoreTypeUsage.Facets[MaxLengthFacetName].Value)); } Debug.Fail("Unknown primitive type kind."); throw new NotSupportedException(); }
private static TypeUsage ConvertFromLegacyEdmTypeUsage(LegacyMetadata.TypeUsage legacyTypeUsage) { Debug.Assert(legacyTypeUsage != null, "legacyTypeUsage != null"); Debug.Assert(legacyTypeUsage.EdmType is LegacyMetadata.PrimitiveType, "primitive type expected."); Debug.Assert( (LegacyMetadata.DataSpace) typeof(LegacyMetadata.EdmType) .GetProperty("DataSpace", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(legacyTypeUsage.EdmType) == LegacyMetadata.DataSpace.CSpace, "Expected CSpace type."); var legacyPrimitiveEdmType = (LegacyMetadata.PrimitiveType)legacyTypeUsage.EdmType; var primitiveEdmType = FromLegacyPrimitiveType(legacyPrimitiveEdmType); switch (legacyPrimitiveEdmType.PrimitiveTypeKind) { case LegacyMetadata.PrimitiveTypeKind.Boolean: case LegacyMetadata.PrimitiveTypeKind.Byte: case LegacyMetadata.PrimitiveTypeKind.SByte: case LegacyMetadata.PrimitiveTypeKind.Int16: case LegacyMetadata.PrimitiveTypeKind.Int32: case LegacyMetadata.PrimitiveTypeKind.Int64: case LegacyMetadata.PrimitiveTypeKind.Guid: case LegacyMetadata.PrimitiveTypeKind.Double: case LegacyMetadata.PrimitiveTypeKind.Single: case LegacyMetadata.PrimitiveTypeKind.Geography: case LegacyMetadata.PrimitiveTypeKind.GeographyPoint: case LegacyMetadata.PrimitiveTypeKind.GeographyLineString: case LegacyMetadata.PrimitiveTypeKind.GeographyPolygon: case LegacyMetadata.PrimitiveTypeKind.GeographyMultiPoint: case LegacyMetadata.PrimitiveTypeKind.GeographyMultiLineString: case LegacyMetadata.PrimitiveTypeKind.GeographyMultiPolygon: case LegacyMetadata.PrimitiveTypeKind.GeographyCollection: case LegacyMetadata.PrimitiveTypeKind.Geometry: case LegacyMetadata.PrimitiveTypeKind.GeometryPoint: case LegacyMetadata.PrimitiveTypeKind.GeometryLineString: case LegacyMetadata.PrimitiveTypeKind.GeometryPolygon: case LegacyMetadata.PrimitiveTypeKind.GeometryMultiPoint: case LegacyMetadata.PrimitiveTypeKind.GeometryMultiLineString: case LegacyMetadata.PrimitiveTypeKind.GeometryMultiPolygon: case LegacyMetadata.PrimitiveTypeKind.GeometryCollection: return(TypeUsage.CreateDefaultTypeUsage(primitiveEdmType)); case LegacyMetadata.PrimitiveTypeKind.Decimal: var precisionFacetValue = legacyTypeUsage.Facets[PrecisionFacetName].Value; if (precisionFacetValue == null || precisionFacetValue == TypeUsageHelper.LegacyUnboundedValue) { Debug.Assert( legacyTypeUsage.Facets[ScaleFacetName].Value == precisionFacetValue, "Precision and Scale facets are expected to be both unbounded (Max) or null"); return(TypeUsage.CreateDecimalTypeUsage(primitiveEdmType)); } else { var scaleFacetValue = legacyTypeUsage.Facets[ScaleFacetName].Value; Debug.Assert( precisionFacetValue is byte && scaleFacetValue is byte, "Precision and Scale facets are expected to be both unbounded (Max) or both of byte type"); return (TypeUsage.CreateDecimalTypeUsage( primitiveEdmType, (byte)precisionFacetValue, (byte)scaleFacetValue)); } case LegacyMetadata.PrimitiveTypeKind.Binary: Debug.Assert( !(legacyTypeUsage.Facets[FixedLengthFacetName].Value == null ^ legacyTypeUsage.Facets[MaxLengthFacetName].Value == null), "Both Fixed Length and Max Length facet values should be null or none should be null"); var fixedLengthFacetValue = legacyTypeUsage.Facets[FixedLengthFacetName].Value; if (fixedLengthFacetValue == null) { return(TypeUsage.CreateDefaultTypeUsage(primitiveEdmType)); } else { var maxLengthBinaryFacetValue = legacyTypeUsage.Facets[MaxLengthFacetName].Value; return (maxLengthBinaryFacetValue == TypeUsageHelper.LegacyUnboundedValue ? TypeUsage.CreateBinaryTypeUsage( primitiveEdmType, (bool)fixedLengthFacetValue) : TypeUsage.CreateBinaryTypeUsage( primitiveEdmType, (bool)fixedLengthFacetValue, (int)maxLengthBinaryFacetValue)); } case LegacyMetadata.PrimitiveTypeKind.DateTime: return(TypeUsage.CreateDateTimeTypeUsage( primitiveEdmType, (byte?)legacyTypeUsage.Facets[PrecisionFacetName].Value)); case LegacyMetadata.PrimitiveTypeKind.DateTimeOffset: return(TypeUsage.CreateDateTimeOffsetTypeUsage( primitiveEdmType, (byte?)legacyTypeUsage.Facets[PrecisionFacetName].Value)); case LegacyMetadata.PrimitiveTypeKind.Time: return(TypeUsage.CreateTimeTypeUsage( primitiveEdmType, (byte?)legacyTypeUsage.Facets[PrecisionFacetName].Value)); case LegacyMetadata.PrimitiveTypeKind.String: var maxLengthStringFacetValue = legacyTypeUsage.Facets[MaxLengthFacetName].Value; if (maxLengthStringFacetValue == null) { return(TypeUsage.CreateDefaultTypeUsage(primitiveEdmType)); } else { return(maxLengthStringFacetValue == TypeUsageHelper.LegacyUnboundedValue ? TypeUsage.CreateStringTypeUsage( primitiveEdmType, (bool)legacyTypeUsage.Facets[UnicodeFacetName].Value, (bool)legacyTypeUsage.Facets[FixedLengthFacetName].Value) : TypeUsage.CreateStringTypeUsage( primitiveEdmType, (bool)legacyTypeUsage.Facets[UnicodeFacetName].Value, (bool)legacyTypeUsage.Facets[FixedLengthFacetName].Value, (int)maxLengthStringFacetValue)); } } Debug.Fail("Unknown primitive type kind."); throw new NotSupportedException(); }
public override TypeUsage GetEdmType(TypeUsage storeType) { if (EFProviderSettings.s_tracingEnabled) { EFProviderSettings.Instance.Trace(EFProviderSettings.EFTraceLevel.Entry, " (ENTRY) EFOracleProviderManifest::GetEdmType()\n"); } EntityUtils.CheckArgumentNull <TypeUsage>(storeType, nameof(storeType)); string lowerInvariant = storeType.EdmType.Name.ToLowerInvariant(); if (!this.StoreTypeNameToEdmPrimitiveType.ContainsKey(lowerInvariant)) { throw new ArgumentException(EFProviderSettings.Instance.GetErrorMessage(-1703, "Oracle Data Provider for .NET", lowerInvariant)); } PrimitiveType primitiveType = this.StoreTypeNameToEdmPrimitiveType[lowerInvariant]; int maxLength = 0; bool isUnicode = true; if (EFProviderSettings.s_tracingEnabled) { EFProviderSettings.Instance.Trace(EFProviderSettings.EFTraceLevel.Entry, " (EXIT) EFOracleProviderManifest::GetEdmType()\n"); } PrimitiveTypeKind primitiveTypeKind1; bool flag; bool isFixedLength; switch (lowerInvariant) { case "int": case "smallint": case "binary_integer": case "pl/sql boolean": return(TypeUsage.CreateDefaultTypeUsage((EdmType)primitiveType)); case "mlslabel": return(TypeUsage.CreateBinaryTypeUsage(primitiveType, true, 12345)); case "varchar2": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isUnicode = false; isFixedLength = false; break; case "char": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isUnicode = false; isFixedLength = true; break; case "nvarchar2": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isUnicode = true; isFixedLength = false; break; case "nchar": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isUnicode = true; isFixedLength = true; break; case "clob": case "long": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = true; isUnicode = false; isFixedLength = false; break; case "xmltype": case "nclob": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = true; isUnicode = true; isFixedLength = false; break; case "blob": case "bfile": primitiveTypeKind1 = PrimitiveTypeKind.Binary; flag = true; isFixedLength = false; break; case "raw": primitiveTypeKind1 = PrimitiveTypeKind.Binary; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isFixedLength = false; if (maxLength == 16) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Guid))); } break; case "long raw": primitiveTypeKind1 = PrimitiveTypeKind.Binary; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isFixedLength = false; break; case "guid raw": return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Guid))); case "guid": case "binary_float": case "binary_double": return(TypeUsage.CreateDefaultTypeUsage((EdmType)primitiveType)); case "rowid": case "urowid": primitiveTypeKind1 = PrimitiveTypeKind.String; flag = !EF6MetadataHelpers.TryGetMaxLength(storeType, out maxLength); isUnicode = false; isFixedLength = false; break; case "float": byte precision1; byte scale1; if (!EF6MetadataHelpers.TryGetPrecision(storeType, out precision1) || !EF6MetadataHelpers.TryGetScale(storeType, out scale1)) { return(TypeUsage.CreateDecimalTypeUsage(primitiveType)); } byte precision2 = byte.Parse(((int)((double)Convert.ToInt32(precision1) * 0.30103 + 1.0)).ToString()); return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision2, scale1)); case "odp_internal_use_type": return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Boolean))); case "number": byte precision3; byte scale2; if (!EF6MetadataHelpers.TryGetPrecision(storeType, out precision3) || !EF6MetadataHelpers.TryGetScale(storeType, out scale2)) { return(TypeUsage.CreateDecimalTypeUsage(primitiveType)); } if (!ConfigBaseClass.s_bLegacyEdmMappingPresent && (int)scale2 == 0) { if ((int)precision3 < 0 || (int)precision3 > 38) { precision3 = (byte)0; } DbType key = ConfigBaseClass.s_edmPrecisonMapping[(int)precision3]; if (EFOracleProviderManifest.s_DbTypeToPrimitiveTypeKind.ContainsKey(key)) { PrimitiveTypeKind primitiveTypeKind2; EFOracleProviderManifest.s_DbTypeToPrimitiveTypeKind.TryGetValue(key, out primitiveTypeKind2); if (primitiveTypeKind2 == PrimitiveTypeKind.Boolean || primitiveTypeKind2 == PrimitiveTypeKind.Byte || (primitiveTypeKind2 == PrimitiveTypeKind.Int16 || primitiveTypeKind2 == PrimitiveTypeKind.Int32) || primitiveTypeKind2 == PrimitiveTypeKind.Int64) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(primitiveTypeKind2))); } if (primitiveTypeKind2 == PrimitiveTypeKind.Decimal) { return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision3, scale2)); } } } if ((int)precision3 == 1 && (int)scale2 == 0) { if (EFOracleProviderManifest.m_bMapNumberToBoolean && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxBOOL) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Boolean))); } if (EFOracleProviderManifest.m_bMapNumberToByte && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxBYTE) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Byte))); } return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int16))); } if (EFOracleProviderManifest.m_bMapNumberToByte && (int)scale2 == 0 && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxBYTE) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Byte))); } if ((int)scale2 == 0 && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxINT16) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int16))); } if ((int)scale2 == 0 && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxINT32) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32))); } if ((int)scale2 == 0 && (int)precision3 <= (int)(byte)EFOracleProviderManifest.m_edmMappingMaxINT64) { return(TypeUsage.CreateDefaultTypeUsage((EdmType)PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int64))); } return(TypeUsage.CreateDecimalTypeUsage(primitiveType, precision3, scale2)); case "date": return(TypeUsage.CreateDateTimeTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.DateTime), new byte?())); case "timestamp": byte byteValue; if (EF6MetadataHelpers.TryGetByteFacetValue(storeType, "Precision", out byteValue)) { return(TypeUsage.CreateDateTimeTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.DateTime), new byte?(byteValue))); } return(TypeUsage.CreateDateTimeTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.DateTime), new byte?((byte)9))); case "timestamp with time zone": return(TypeUsage.CreateDateTimeOffsetTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.DateTimeOffset), new byte?((byte)9))); case "timestamp with local time zone": return(TypeUsage.CreateDateTimeTypeUsage(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.DateTime), new byte?(byte.MaxValue))); case "interval year to month": return(TypeUsage.CreateDecimalTypeUsage(primitiveType, (byte)250, (byte)0)); case "interval day to second": return(TypeUsage.CreateDecimalTypeUsage(primitiveType, (byte)251, (byte)0)); default: throw new NotSupportedException(EFProviderSettings.Instance.GetErrorMessage(-1703, "Oracle Data Provider for .NET", lowerInvariant)); } switch (primitiveTypeKind1) { 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(EFProviderSettings.Instance.GetErrorMessage(-1703, "Oracle Data Provider for .NET", lowerInvariant)); } }
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)); } }