SqlProviderManifest.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlProviderManifest.cs / 1 / SqlProviderManifest.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
//--------------------------------------------------------------------- 
using System.Collections.Generic; 
using System.Xml;
using System.Collections.ObjectModel; 
using System.Data.EntityModel.SchemaObjectModel;
using System.Data.EntityModel;
using System.Data.Common;
using System.Diagnostics; 
using System.Data.Entity;
using System.Data.SqlClient; 
using System.Data.Metadata.Edm; 

 
namespace System.Data.SqlClient
{
    /// 
    /// The Provider Manifest for SQL Server 
    /// 
    internal class SqlProviderManifest : DbXmlEnabledProviderManifest 
    { 
        internal const string TokenSql8 = "2000";
        internal const string TokenSql9 = "2005"; 
        internal const string TokenSql10 = "2008";

        #region Private Fields
 
        // Default to SQL Server 2005 (9.0)
        private SqlVersion _version = SqlVersion.Sql9; 
 
        /// 
        /// maximum size of sql server unicode 
        /// 
        private const int varcharMaxSize = 8000;
        private const int nvarcharMaxSize = 4000;
        private const int binaryMaxSize = 8000; 

        private System.Collections.ObjectModel.ReadOnlyCollection _primitiveTypes = null; 
        private System.Collections.ObjectModel.ReadOnlyCollection _functions = null; 

        #endregion 

        #region Constructors

        ///  
        /// Constructor
        ///  
        /// A token used to infer the capabilities of the store 
        public SqlProviderManifest(string manifestToken)
            : base(SqlProviderManifest.GetProviderManifest()) 
        {
            // GetSqlVersion will throw ArgumentException if manifestToken is null, empty, or not recognized.
            _version = SqlVersionUtils.GetSqlVersion(manifestToken);
        } 

 
        #endregion 

        #region Properties 

        internal SqlVersion SqlVersion
        {
            get { return this._version; } 
        }
 
        #endregion 

        private static XmlReader GetProviderManifest() 
        {
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.ProviderManifest.xml");
        }
 
        /// 
        /// Providers should override this to return information specific to their provider. 
        /// 
        /// This method should never return null.
        ///  
        /// The name of the information to be retrieved.
        /// An XmlReader at the begining of the information requested.
        protected override XmlReader GetDbInformation(string informationType)
        { 
            if (informationType == DbProviderManifest.StoreSchemaDefinition)
            { 
                return GetStoreSchemaDescription(); 
            }
 
            if (informationType == DbProviderManifest.StoreSchemaMapping)
            {
                return GetStoreSchemaMapping();
            } 

            // Use default Conceptual Schema Definition 
            if (informationType == DbProviderManifest.ConceptualSchemaDefinition) 
            {
                return null; 
            }

            throw EntityUtil.ProviderIncompatible(System.Data.Entity.Strings.ProviderReturnedNullForGetDbInformation(informationType));
        } 

        public override System.Collections.ObjectModel.ReadOnlyCollection GetStoreTypes() 
        { 
            if (this._primitiveTypes == null)
            { 
                if (this._version == SqlVersion.Sql10)
                {
                    this._primitiveTypes = base.GetStoreTypes();
                } 
                else
                { 
                    List primitiveTypes = new List(base.GetStoreTypes()); 
                    Debug.Assert((this._version == SqlVersion.Sql8) || (this._version == SqlVersion.Sql9), "Found verion other than Sql 8, 9 or 10");
                    //Remove the Katmai types for both Sql8 and Sql9 
                    primitiveTypes.RemoveAll(new Predicate(
                                                        delegate(PrimitiveType primitiveType)
                                                        {
                                                            string name = primitiveType.Name.ToLowerInvariant(); 
                                                            return name.Equals("time", StringComparison.Ordinal) ||
                                                                   name.Equals("date", StringComparison.Ordinal) || 
                                                                   name.Equals("datetime2", StringComparison.Ordinal) || 
                                                                   name.Equals("datetimeoffset", StringComparison.Ordinal);
                                                        } 
                                                    )
                                        );
                    //Remove the types that won't work in Sql8
                    if (this._version == SqlVersion.Sql8)                    { 

                        // SQLBUDT 550667 and 551271: Remove xml and 'max' types for SQL Server 2000 
                        primitiveTypes.RemoveAll(new Predicate( 
                                                            delegate(PrimitiveType primitiveType)
                                                            { 
                                                                string name = primitiveType.Name.ToLowerInvariant();
                                                                return name.Equals("xml", StringComparison.Ordinal) || name.EndsWith("(max)", StringComparison.Ordinal);
                                                            }
                                                        ) 
                                            );
                    } 
                    this._primitiveTypes = primitiveTypes.AsReadOnly(); 
                }
            } 

            return this._primitiveTypes;
        }
 
        public override System.Collections.ObjectModel.ReadOnlyCollection GetStoreFunctions()
        { 
            if (this._functions == null) 
            {
                if (this._version == SqlVersion.Sql10) 
                {
                    this._functions = base.GetStoreFunctions();
                }
                else 
                {
                    List functions = new List(base.GetStoreFunctions()); 
                    //Remove the functions over katmai types from both Sql 9 and Sql 10. 
                    functions.RemoveAll(new Predicate(
                                    delegate(EdmFunction edmFunction) 
                                    {
                                        ReadOnlyMetadataCollection funParams = edmFunction.Parameters;
                                        switch (edmFunction.Name.ToUpperInvariant())
                                        { 
                                            case "COUNT":
                                            case "COUNT_BIG": 
                                            case "MAX": 
                                            case "MIN":
                                                { 
                                                    string name = ((CollectionType)funParams[0].TypeUsage.EdmType).TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) ||
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
 
                                                }
                                            case "DAY": 
                                            case "MONTH": 
                                            case "YEAR":
                                            case "DATALENGTH": 
                                            case "CHECKSUM":
                                                {
                                                    string name = funParams[0].TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
 
                                                } 
                                            case "DATEADD":
                                            case "DATEDIFF": 
                                                {
                                                    string param1Name = funParams[1].TypeUsage.EdmType.Name;
                                                    string param2Name = funParams[2].TypeUsage.EdmType.Name;
                                                    return ( (param1Name.Equals("Time", StringComparison.OrdinalIgnoreCase)) || 
                                                           (param2Name.Equals("Time", StringComparison.OrdinalIgnoreCase)) ||
                                                           (param1Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (param2Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase))); 
                                                }
                                            case "DATENAME": 
                                            case "DATEPART":
                                                {
                                                    string name = funParams[1].TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
                                                } 
                                            case "SYSUTCDATETIME": 
                                            case "SYSDATETIME":
                                            case "SYSDATETIMEOFFSET": 
                                                return true;
                                            default:
                                                break;
                                        } 

                                        return false; 
                                    } 
                                )
                    ); 



                    if (this._version == SqlVersion.Sql8) 
                    {
                        // SQLBUDT 550998: Remove unsupported overloads from Provider Manifest on SQL 8.0 
                        functions.RemoveAll(new Predicate( 
                                                            delegate(EdmFunction edmFunction)
                                                            { 
                                                                ReadOnlyMetadataCollection funParams = edmFunction.Parameters;
                                                                if (funParams == null || funParams.Count == 0)
                                                                {
                                                                    return false; 
                                                                }
 
                                                                switch (edmFunction.Name.ToUpperInvariant()) 
                                                                {
                                                                    case "COUNT": 
                                                                    case "COUNT_BIG":
                                                                        {
                                                                            string name = ((CollectionType)funParams[0].TypeUsage.EdmType).TypeUsage.EdmType.Name;
                                                                            return name.Equals("Guid", StringComparison.OrdinalIgnoreCase); 
                                                                        }
 
                                                                    case "CHARINDEX": 
                                                                        {
                                                                            foreach (FunctionParameter funParam in funParams) 
                                                                            {
                                                                                if (funParam.TypeUsage.EdmType.Name.Equals("Int64", StringComparison.OrdinalIgnoreCase))
                                                                                {
                                                                                    return true; 
                                                                                }
                                                                            } 
                                                                        } 
                                                                        break;
 
                                                                    default:
                                                                        break;
                                                                }
 
                                                                return false;
                                                            } 
                                                        ) 
                                            );
                    } 
                    this._functions = functions.AsReadOnly();
                }
            }
 
            return this._functions;
        } 
 
        /// 
        /// This method takes a type and a set of facets and returns the best mapped equivalent type 
        /// in EDM.
        /// 
        /// A TypeUsage encapsulating a store type and a set of facets
        /// A TypeUsage encapsulating an EDM type and a set of facets 
        public override TypeUsage GetEdmType(TypeUsage storeType)
        { 
            EntityUtil.CheckArgumentNull(storeType, "storeType"); 

            string storeTypeName = storeType.EdmType.Name.ToLowerInvariant(); 
            if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw EntityUtil.Argument(Strings.ProviderDoesNotSupportType(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":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType); 
 
                case "varchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String; 
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, out maxLength);
                    isUnicode = false;
                    isFixedLen = false;
                    break; 

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

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

                case "nchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, 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 = !TypeHelpers.TryGetMaxLength(storeType, out maxLength);
                    isFixedLen = true;
                    break;
 
                case "varbinary":
                    newPrimitiveTypeKind = PrimitiveTypeKind.Binary; 
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, 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 (TypeHelpers.TryGetPrecision(storeType, out precision) && TypeHelpers.TryGetScale(storeType, 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 EntityUtil.NotSupported(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 EntityUtil.NotSupported(Strings.ProviderDoesNotSupportType(storeTypeName)); 
            }
        } 
 
        /// 
        /// This method takes a type and a set of facets and returns the best mapped equivalent type 
        /// in SQL Server, taking the store version into consideration.
        /// 
        /// A TypeUsage encapsulating an EDM type and a set of facets
        /// A TypeUsage encapsulating a store type and a set of facets 
        public override TypeUsage GetStoreType(TypeUsage edmType)
        { 
            EntityUtil.CheckArgumentNull(edmType, "edmType"); 
            System.Diagnostics.Debug.Assert(edmType.EdmType.BuiltInTypeKind == BuiltInTypeKind.PrimitiveType);
 
            PrimitiveType primitiveType = edmType.EdmType as PrimitiveType;
            if (primitiveType == null)
            {
                throw EntityUtil.Argument(Strings.ProviderDoesNotSupportType(edmType.Identity)); 
            }
 
            ReadOnlyMetadataCollection facets = edmType.Facets; 

            switch (primitiveType.PrimitiveTypeKind) 
            {
                case PrimitiveTypeKind.Boolean:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["bit"]);
 
                case PrimitiveTypeKind.Byte:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["tinyint"]); 
 
                case PrimitiveTypeKind.Int16:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["smallint"]); 

                case PrimitiveTypeKind.Int32:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int"]);
 
                case PrimitiveTypeKind.Int64:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["bigint"]); 
 
                case PrimitiveTypeKind.Guid:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["uniqueidentifier"]); 

                case PrimitiveTypeKind.Double:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["float"]);
 
                case PrimitiveTypeKind.Single:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["real"]); 
 
                case PrimitiveTypeKind.Decimal: // decimal, numeric, smallmoney, money
                    { 
                        byte precision;
                        if (!TypeHelpers.TryGetPrecision(edmType, out precision))
                        {
                            precision = 18; 
                        }
 
                        byte scale; 
                        if (!TypeHelpers.TryGetScale(edmType, out scale))
                        { 
                            scale = 0;
                        }
                        TypeUsage tu = TypeUsage.CreateDecimalTypeUsage(StoreTypeNameToStorePrimitiveType["decimal"], precision, scale);
                        return tu; 
                    }
 
                case PrimitiveTypeKind.Binary: // binary, varbinary, varbinary(max), image, timestamp, rowversion 
                    {
                        bool isFixedLength = null != facets[DbProviderManifest.FixedLengthFacetName].Value && (bool)facets[DbProviderManifest.FixedLengthFacetName].Value; 
                        Facet f = facets[DbProviderManifest.MaxLengthFacetName];
                        bool isMaxLength = Helper.IsUnboundedFacetValue(f) || null == f.Value || (int)f.Value > binaryMaxSize;
                        int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue;
 
                        TypeUsage tu;
                        if (isFixedLength) 
                        { 
                            tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["binary"], true, (isMaxLength ? binaryMaxSize : maxLength));
                        } 
                        else
                        {
                            if (isMaxLength)
                            { 
                                if (_version != SqlVersion.Sql8)
                                { 
 
                                    tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary(max)"], false);
                                    Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "varbinary(max) is not constant!"); 
                                }
                                else
                                {
                                    tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary"], false, binaryMaxSize); 
                                }
                            } 
                            else 
                            {
                                tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary"], false, maxLength); 
                            }
                        }
                        return tu;
                    } 

                case PrimitiveTypeKind.String: 
                    // char, nchar, varchar, nvarchar, varchar(max), nvarchar(max), ntext, text, xml 
                    {
                        bool isUnicode = null == facets[DbProviderManifest.UnicodeFacetName].Value || (bool)facets[DbProviderManifest.UnicodeFacetName].Value; 
                        bool isFixedLength = null != facets[DbProviderManifest.FixedLengthFacetName].Value && (bool)facets[DbProviderManifest.FixedLengthFacetName].Value;
                        Facet f = facets[DbProviderManifest.MaxLengthFacetName];
                        // maxlen is true if facet value is unbounded, the value is bigger than the limited string sizes *or* the facet
                        // value is null. this is needed since functions still have maxlength facet value as null 
                        bool isMaxLength = Helper.IsUnboundedFacetValue(f) || null == f.Value || (int)f.Value > (isUnicode ? nvarcharMaxSize : varcharMaxSize);
                        int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue; 
 
                        TypeUsage tu;
 
                        if (isUnicode)
                        {
                            if (isFixedLength)
                            { 
                                tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nchar"], true, true, (isMaxLength ? nvarcharMaxSize : maxLength));
                            } 
                            else 
                            {
                                if (isMaxLength) 
                                {
                                    // nvarchar(max) (SQL 9) or ntext (SQL 8)
                                    if (_version != SqlVersion.Sql8)
                                    { 
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar(max)"], true, false);
                                        Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "NVarchar(max) is not constant!"); 
                                    } 
                                    else
                                    { 
                                        // if it is unknown, fallback to nvarchar[4000] instead of ntext since it has limited store semantics
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar"], true, false, nvarcharMaxSize);
                                    }
                                } 
                                else
                                { 
                                    tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar"], true, false, maxLength); 
                                }
                            } 
                        }
                        else    // !isUnicode
                        {
                            if (isFixedLength) 
                            {
                                tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["char"], false, true, 
                                    (isMaxLength ? varcharMaxSize : maxLength)); 
                            }
                            else 
                            {
                                if (isMaxLength)
                                {
                                    // nvarchar(max) (SQL 9) or ntext (SQL 8) 
                                    if (_version != SqlVersion.Sql8)
                                    { 
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar(max)"], false, false); 
                                        Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "varchar(max) is not constant!");
                                    } 
                                    else
                                    {
                                        // if it is unknown, fallback to varchar[8000] instead of text since it has limited store semantics
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar"], false, false, varcharMaxSize); 
                                    }
                                } 
                                else 
                                {
                                    tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar"], false, false, maxLength); 
                                }
                            }
                        }
                        return tu; 
                    }
 
 
                case PrimitiveTypeKind.DateTime:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["datetime"]); 
                case PrimitiveTypeKind.DateTimeOffset:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["datetimeoffset"]);
                case PrimitiveTypeKind.Time:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["time"]); 

                default: 
                    throw EntityUtil.NotSupported(Strings.NoStoreTypeForEdmType(edmType.Identity, primitiveType.PrimitiveTypeKind)); 
            }
        } 

        private XmlReader GetStoreSchemaMapping()
        {
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping.msl"); 
        }
 
        private XmlReader GetStoreSchemaDescription() 
        {
            if (this._version == SqlVersion.Sql8) 
            {
                return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition_Sql8.ssdl");
            }
 
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition.ssdl");
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
//--------------------------------------------------------------------- 
using System.Collections.Generic; 
using System.Xml;
using System.Collections.ObjectModel; 
using System.Data.EntityModel.SchemaObjectModel;
using System.Data.EntityModel;
using System.Data.Common;
using System.Diagnostics; 
using System.Data.Entity;
using System.Data.SqlClient; 
using System.Data.Metadata.Edm; 

 
namespace System.Data.SqlClient
{
    /// 
    /// The Provider Manifest for SQL Server 
    /// 
    internal class SqlProviderManifest : DbXmlEnabledProviderManifest 
    { 
        internal const string TokenSql8 = "2000";
        internal const string TokenSql9 = "2005"; 
        internal const string TokenSql10 = "2008";

        #region Private Fields
 
        // Default to SQL Server 2005 (9.0)
        private SqlVersion _version = SqlVersion.Sql9; 
 
        /// 
        /// maximum size of sql server unicode 
        /// 
        private const int varcharMaxSize = 8000;
        private const int nvarcharMaxSize = 4000;
        private const int binaryMaxSize = 8000; 

        private System.Collections.ObjectModel.ReadOnlyCollection _primitiveTypes = null; 
        private System.Collections.ObjectModel.ReadOnlyCollection _functions = null; 

        #endregion 

        #region Constructors

        ///  
        /// Constructor
        ///  
        /// A token used to infer the capabilities of the store 
        public SqlProviderManifest(string manifestToken)
            : base(SqlProviderManifest.GetProviderManifest()) 
        {
            // GetSqlVersion will throw ArgumentException if manifestToken is null, empty, or not recognized.
            _version = SqlVersionUtils.GetSqlVersion(manifestToken);
        } 

 
        #endregion 

        #region Properties 

        internal SqlVersion SqlVersion
        {
            get { return this._version; } 
        }
 
        #endregion 

        private static XmlReader GetProviderManifest() 
        {
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.ProviderManifest.xml");
        }
 
        /// 
        /// Providers should override this to return information specific to their provider. 
        /// 
        /// This method should never return null.
        ///  
        /// The name of the information to be retrieved.
        /// An XmlReader at the begining of the information requested.
        protected override XmlReader GetDbInformation(string informationType)
        { 
            if (informationType == DbProviderManifest.StoreSchemaDefinition)
            { 
                return GetStoreSchemaDescription(); 
            }
 
            if (informationType == DbProviderManifest.StoreSchemaMapping)
            {
                return GetStoreSchemaMapping();
            } 

            // Use default Conceptual Schema Definition 
            if (informationType == DbProviderManifest.ConceptualSchemaDefinition) 
            {
                return null; 
            }

            throw EntityUtil.ProviderIncompatible(System.Data.Entity.Strings.ProviderReturnedNullForGetDbInformation(informationType));
        } 

        public override System.Collections.ObjectModel.ReadOnlyCollection GetStoreTypes() 
        { 
            if (this._primitiveTypes == null)
            { 
                if (this._version == SqlVersion.Sql10)
                {
                    this._primitiveTypes = base.GetStoreTypes();
                } 
                else
                { 
                    List primitiveTypes = new List(base.GetStoreTypes()); 
                    Debug.Assert((this._version == SqlVersion.Sql8) || (this._version == SqlVersion.Sql9), "Found verion other than Sql 8, 9 or 10");
                    //Remove the Katmai types for both Sql8 and Sql9 
                    primitiveTypes.RemoveAll(new Predicate(
                                                        delegate(PrimitiveType primitiveType)
                                                        {
                                                            string name = primitiveType.Name.ToLowerInvariant(); 
                                                            return name.Equals("time", StringComparison.Ordinal) ||
                                                                   name.Equals("date", StringComparison.Ordinal) || 
                                                                   name.Equals("datetime2", StringComparison.Ordinal) || 
                                                                   name.Equals("datetimeoffset", StringComparison.Ordinal);
                                                        } 
                                                    )
                                        );
                    //Remove the types that won't work in Sql8
                    if (this._version == SqlVersion.Sql8)                    { 

                        // SQLBUDT 550667 and 551271: Remove xml and 'max' types for SQL Server 2000 
                        primitiveTypes.RemoveAll(new Predicate( 
                                                            delegate(PrimitiveType primitiveType)
                                                            { 
                                                                string name = primitiveType.Name.ToLowerInvariant();
                                                                return name.Equals("xml", StringComparison.Ordinal) || name.EndsWith("(max)", StringComparison.Ordinal);
                                                            }
                                                        ) 
                                            );
                    } 
                    this._primitiveTypes = primitiveTypes.AsReadOnly(); 
                }
            } 

            return this._primitiveTypes;
        }
 
        public override System.Collections.ObjectModel.ReadOnlyCollection GetStoreFunctions()
        { 
            if (this._functions == null) 
            {
                if (this._version == SqlVersion.Sql10) 
                {
                    this._functions = base.GetStoreFunctions();
                }
                else 
                {
                    List functions = new List(base.GetStoreFunctions()); 
                    //Remove the functions over katmai types from both Sql 9 and Sql 10. 
                    functions.RemoveAll(new Predicate(
                                    delegate(EdmFunction edmFunction) 
                                    {
                                        ReadOnlyMetadataCollection funParams = edmFunction.Parameters;
                                        switch (edmFunction.Name.ToUpperInvariant())
                                        { 
                                            case "COUNT":
                                            case "COUNT_BIG": 
                                            case "MAX": 
                                            case "MIN":
                                                { 
                                                    string name = ((CollectionType)funParams[0].TypeUsage.EdmType).TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) ||
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
 
                                                }
                                            case "DAY": 
                                            case "MONTH": 
                                            case "YEAR":
                                            case "DATALENGTH": 
                                            case "CHECKSUM":
                                                {
                                                    string name = funParams[0].TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
 
                                                } 
                                            case "DATEADD":
                                            case "DATEDIFF": 
                                                {
                                                    string param1Name = funParams[1].TypeUsage.EdmType.Name;
                                                    string param2Name = funParams[2].TypeUsage.EdmType.Name;
                                                    return ( (param1Name.Equals("Time", StringComparison.OrdinalIgnoreCase)) || 
                                                           (param2Name.Equals("Time", StringComparison.OrdinalIgnoreCase)) ||
                                                           (param1Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (param2Name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase))); 
                                                }
                                            case "DATENAME": 
                                            case "DATEPART":
                                                {
                                                    string name = funParams[1].TypeUsage.EdmType.Name;
                                                    return ((name.Equals("DateTimeOffset", StringComparison.OrdinalIgnoreCase)) || 
                                                           (name.Equals("Time", StringComparison.OrdinalIgnoreCase)));
                                                } 
                                            case "SYSUTCDATETIME": 
                                            case "SYSDATETIME":
                                            case "SYSDATETIMEOFFSET": 
                                                return true;
                                            default:
                                                break;
                                        } 

                                        return false; 
                                    } 
                                )
                    ); 



                    if (this._version == SqlVersion.Sql8) 
                    {
                        // SQLBUDT 550998: Remove unsupported overloads from Provider Manifest on SQL 8.0 
                        functions.RemoveAll(new Predicate( 
                                                            delegate(EdmFunction edmFunction)
                                                            { 
                                                                ReadOnlyMetadataCollection funParams = edmFunction.Parameters;
                                                                if (funParams == null || funParams.Count == 0)
                                                                {
                                                                    return false; 
                                                                }
 
                                                                switch (edmFunction.Name.ToUpperInvariant()) 
                                                                {
                                                                    case "COUNT": 
                                                                    case "COUNT_BIG":
                                                                        {
                                                                            string name = ((CollectionType)funParams[0].TypeUsage.EdmType).TypeUsage.EdmType.Name;
                                                                            return name.Equals("Guid", StringComparison.OrdinalIgnoreCase); 
                                                                        }
 
                                                                    case "CHARINDEX": 
                                                                        {
                                                                            foreach (FunctionParameter funParam in funParams) 
                                                                            {
                                                                                if (funParam.TypeUsage.EdmType.Name.Equals("Int64", StringComparison.OrdinalIgnoreCase))
                                                                                {
                                                                                    return true; 
                                                                                }
                                                                            } 
                                                                        } 
                                                                        break;
 
                                                                    default:
                                                                        break;
                                                                }
 
                                                                return false;
                                                            } 
                                                        ) 
                                            );
                    } 
                    this._functions = functions.AsReadOnly();
                }
            }
 
            return this._functions;
        } 
 
        /// 
        /// This method takes a type and a set of facets and returns the best mapped equivalent type 
        /// in EDM.
        /// 
        /// A TypeUsage encapsulating a store type and a set of facets
        /// A TypeUsage encapsulating an EDM type and a set of facets 
        public override TypeUsage GetEdmType(TypeUsage storeType)
        { 
            EntityUtil.CheckArgumentNull(storeType, "storeType"); 

            string storeTypeName = storeType.EdmType.Name.ToLowerInvariant(); 
            if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
            {
                throw EntityUtil.Argument(Strings.ProviderDoesNotSupportType(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":
                    return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType); 
 
                case "varchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String; 
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, out maxLength);
                    isUnicode = false;
                    isFixedLen = false;
                    break; 

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

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

                case "nchar":
                    newPrimitiveTypeKind = PrimitiveTypeKind.String;
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, 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 = !TypeHelpers.TryGetMaxLength(storeType, out maxLength);
                    isFixedLen = true;
                    break;
 
                case "varbinary":
                    newPrimitiveTypeKind = PrimitiveTypeKind.Binary; 
                    isUnbounded = !TypeHelpers.TryGetMaxLength(storeType, 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 (TypeHelpers.TryGetPrecision(storeType, out precision) && TypeHelpers.TryGetScale(storeType, 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 EntityUtil.NotSupported(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 EntityUtil.NotSupported(Strings.ProviderDoesNotSupportType(storeTypeName)); 
            }
        } 
 
        /// 
        /// This method takes a type and a set of facets and returns the best mapped equivalent type 
        /// in SQL Server, taking the store version into consideration.
        /// 
        /// A TypeUsage encapsulating an EDM type and a set of facets
        /// A TypeUsage encapsulating a store type and a set of facets 
        public override TypeUsage GetStoreType(TypeUsage edmType)
        { 
            EntityUtil.CheckArgumentNull(edmType, "edmType"); 
            System.Diagnostics.Debug.Assert(edmType.EdmType.BuiltInTypeKind == BuiltInTypeKind.PrimitiveType);
 
            PrimitiveType primitiveType = edmType.EdmType as PrimitiveType;
            if (primitiveType == null)
            {
                throw EntityUtil.Argument(Strings.ProviderDoesNotSupportType(edmType.Identity)); 
            }
 
            ReadOnlyMetadataCollection facets = edmType.Facets; 

            switch (primitiveType.PrimitiveTypeKind) 
            {
                case PrimitiveTypeKind.Boolean:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["bit"]);
 
                case PrimitiveTypeKind.Byte:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["tinyint"]); 
 
                case PrimitiveTypeKind.Int16:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["smallint"]); 

                case PrimitiveTypeKind.Int32:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["int"]);
 
                case PrimitiveTypeKind.Int64:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["bigint"]); 
 
                case PrimitiveTypeKind.Guid:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["uniqueidentifier"]); 

                case PrimitiveTypeKind.Double:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["float"]);
 
                case PrimitiveTypeKind.Single:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["real"]); 
 
                case PrimitiveTypeKind.Decimal: // decimal, numeric, smallmoney, money
                    { 
                        byte precision;
                        if (!TypeHelpers.TryGetPrecision(edmType, out precision))
                        {
                            precision = 18; 
                        }
 
                        byte scale; 
                        if (!TypeHelpers.TryGetScale(edmType, out scale))
                        { 
                            scale = 0;
                        }
                        TypeUsage tu = TypeUsage.CreateDecimalTypeUsage(StoreTypeNameToStorePrimitiveType["decimal"], precision, scale);
                        return tu; 
                    }
 
                case PrimitiveTypeKind.Binary: // binary, varbinary, varbinary(max), image, timestamp, rowversion 
                    {
                        bool isFixedLength = null != facets[DbProviderManifest.FixedLengthFacetName].Value && (bool)facets[DbProviderManifest.FixedLengthFacetName].Value; 
                        Facet f = facets[DbProviderManifest.MaxLengthFacetName];
                        bool isMaxLength = Helper.IsUnboundedFacetValue(f) || null == f.Value || (int)f.Value > binaryMaxSize;
                        int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue;
 
                        TypeUsage tu;
                        if (isFixedLength) 
                        { 
                            tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["binary"], true, (isMaxLength ? binaryMaxSize : maxLength));
                        } 
                        else
                        {
                            if (isMaxLength)
                            { 
                                if (_version != SqlVersion.Sql8)
                                { 
 
                                    tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary(max)"], false);
                                    Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "varbinary(max) is not constant!"); 
                                }
                                else
                                {
                                    tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary"], false, binaryMaxSize); 
                                }
                            } 
                            else 
                            {
                                tu = TypeUsage.CreateBinaryTypeUsage(StoreTypeNameToStorePrimitiveType["varbinary"], false, maxLength); 
                            }
                        }
                        return tu;
                    } 

                case PrimitiveTypeKind.String: 
                    // char, nchar, varchar, nvarchar, varchar(max), nvarchar(max), ntext, text, xml 
                    {
                        bool isUnicode = null == facets[DbProviderManifest.UnicodeFacetName].Value || (bool)facets[DbProviderManifest.UnicodeFacetName].Value; 
                        bool isFixedLength = null != facets[DbProviderManifest.FixedLengthFacetName].Value && (bool)facets[DbProviderManifest.FixedLengthFacetName].Value;
                        Facet f = facets[DbProviderManifest.MaxLengthFacetName];
                        // maxlen is true if facet value is unbounded, the value is bigger than the limited string sizes *or* the facet
                        // value is null. this is needed since functions still have maxlength facet value as null 
                        bool isMaxLength = Helper.IsUnboundedFacetValue(f) || null == f.Value || (int)f.Value > (isUnicode ? nvarcharMaxSize : varcharMaxSize);
                        int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue; 
 
                        TypeUsage tu;
 
                        if (isUnicode)
                        {
                            if (isFixedLength)
                            { 
                                tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nchar"], true, true, (isMaxLength ? nvarcharMaxSize : maxLength));
                            } 
                            else 
                            {
                                if (isMaxLength) 
                                {
                                    // nvarchar(max) (SQL 9) or ntext (SQL 8)
                                    if (_version != SqlVersion.Sql8)
                                    { 
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar(max)"], true, false);
                                        Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "NVarchar(max) is not constant!"); 
                                    } 
                                    else
                                    { 
                                        // if it is unknown, fallback to nvarchar[4000] instead of ntext since it has limited store semantics
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar"], true, false, nvarcharMaxSize);
                                    }
                                } 
                                else
                                { 
                                    tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["nvarchar"], true, false, maxLength); 
                                }
                            } 
                        }
                        else    // !isUnicode
                        {
                            if (isFixedLength) 
                            {
                                tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["char"], false, true, 
                                    (isMaxLength ? varcharMaxSize : maxLength)); 
                            }
                            else 
                            {
                                if (isMaxLength)
                                {
                                    // nvarchar(max) (SQL 9) or ntext (SQL 8) 
                                    if (_version != SqlVersion.Sql8)
                                    { 
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar(max)"], false, false); 
                                        Debug.Assert(tu.Facets[DbProviderManifest.MaxLengthFacetName].Description.IsConstant, "varchar(max) is not constant!");
                                    } 
                                    else
                                    {
                                        // if it is unknown, fallback to varchar[8000] instead of text since it has limited store semantics
                                        tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar"], false, false, varcharMaxSize); 
                                    }
                                } 
                                else 
                                {
                                    tu = TypeUsage.CreateStringTypeUsage(StoreTypeNameToStorePrimitiveType["varchar"], false, false, maxLength); 
                                }
                            }
                        }
                        return tu; 
                    }
 
 
                case PrimitiveTypeKind.DateTime:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["datetime"]); 
                case PrimitiveTypeKind.DateTimeOffset:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["datetimeoffset"]);
                case PrimitiveTypeKind.Time:
                    return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["time"]); 

                default: 
                    throw EntityUtil.NotSupported(Strings.NoStoreTypeForEdmType(edmType.Identity, primitiveType.PrimitiveTypeKind)); 
            }
        } 

        private XmlReader GetStoreSchemaMapping()
        {
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping.msl"); 
        }
 
        private XmlReader GetStoreSchemaDescription() 
        {
            if (this._version == SqlVersion.Sql8) 
            {
                return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition_Sql8.ssdl");
            }
 
            return DbProviderServices.GetXmlResource("System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition.ssdl");
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK