EFIngresProvider/EFIngresProviderManifest.cs
/// <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>
This method takes a type and a set of facets and returns the best mapped equivalent type
in EDM.
This method takes a type and a set of facets and returns the best mapped equivalent type in EDM .
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];
            switch (storeTypeName)
            {
                case "tinyint":
                case "smallint":
                case "integer":
                case "bigint":
                case "integer1":
                case "integer2":
                case "integer4":
                case "integer8":
                case "bool":
                case "int1":
                case "int2":
                case "int4":
                case "int8":
                case "float":
                case "float4":
                case "float8":
                case "double":
                case "real":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);
                case "decimal":
                    return CreateDecimalTypeUsage(edmPrimitiveType, TypeHelpers.GetPrecision(storeType), TypeHelpers.GetScale(storeType));
                case "money":
                    return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, 14, 2);
                case "varchar":
                    return CreateStringTypeUsage(edmPrimitiveType, false, false, TypeHelpers.GetMaxLength(storeType));
                case "char":
                    return CreateStringTypeUsage(edmPrimitiveType, false, true, TypeHelpers.GetMaxLength(storeType));
                case "nvarchar":
                    return CreateStringTypeUsage(edmPrimitiveType, true, false, TypeHelpers.GetMaxLength(storeType));
                case "nchar":
                    return CreateStringTypeUsage(edmPrimitiveType, true, true, TypeHelpers.GetMaxLength(storeType));
                case "long varchar":
                    return CreateStringTypeUsage(edmPrimitiveType, false, false);
                case "byte":
                    return CreateBinaryTypeUsage(edmPrimitiveType, true, TypeHelpers.GetMaxLength(storeType));
                case "byte varying":
                    return CreateBinaryTypeUsage(edmPrimitiveType, false, TypeHelpers.GetMaxLength(storeType));
                case "long byte":
                    return CreateBinaryTypeUsage(edmPrimitiveType, false);
                case "timestamp":
                case "rowversion":
                    return TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, true, 8);
                case "date":
                case "ingresdate":
                case "ansidate":
                    return TypeUsage.CreateDateTimeTypeUsage(edmPrimitiveType, null);
                default:
                    throw new NotSupportedException(String.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
            }
        }
public override TypeUsage GetEdmType ( TypeUsage storeType ) { if ( storeType == null ) { throw new ArgumentNullException ( " " ) ; } string storeTypeName = storeType . EdmType . Name . ToLowerInvariant ( ) ; if ( ! base . StoreTypeNameToEdmPrimitiveType . ContainsKey ( storeTypeName ) ) { throw new ArgumentException ( String . Format ( " " , storeTypeName ) ) ; } PrimitiveType edmPrimitiveType = base . StoreTypeNameToEdmPrimitiveType [ storeTypeName ] ; switch ( storeTypeName ) { case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : case " " : return TypeUsage . CreateDefaultTypeUsage ( edmPrimitiveType ) ; case " " : return CreateDecimalTypeUsage ( edmPrimitiveType , TypeHelpers . GetPrecision ( storeType ) , TypeHelpers . GetScale ( storeType ) ) ; case " " : return TypeUsage . CreateDecimalTypeUsage ( edmPrimitiveType , 14 , 2 ) ; case " " : return CreateStringTypeUsage ( edmPrimitiveType , false , false , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateStringTypeUsage ( edmPrimitiveType , false , true , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateStringTypeUsage ( edmPrimitiveType , true , false , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateStringTypeUsage ( edmPrimitiveType , true , true , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateStringTypeUsage ( edmPrimitiveType , false , false ) ; case " " : return CreateBinaryTypeUsage ( edmPrimitiveType , true , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateBinaryTypeUsage ( edmPrimitiveType , false , TypeHelpers . GetMaxLength ( storeType ) ) ; case " " : return CreateBinaryTypeUsage ( edmPrimitiveType , false ) ; case " " : case " " : return TypeUsage . CreateBinaryTypeUsage ( edmPrimitiveType , true , 8 ) ; case " " : case " " : case " " : return TypeUsage . CreateDateTimeTypeUsage ( edmPrimitiveType , null ) ; default : throw new NotSupportedException ( String . Format ( " " , storeTypeName ) ) ; } }
This method takes a type and a set of facets and returns the best mapped equivalent type
in EDM.
This method takes a type and a set of facets and returns the best mapped equivalent type in EDM .
// for some types we just go with simple type usage with no facets
A TypeUsage encapsulating an EDM type and a set of facets
A TypeUsage encapsulating an EDM type and a set of facets
storeType
TypeUsage
A TypeUsage encapsulating a store type and a set of facets
A TypeUsage encapsulating a store type and a set of facets