Exemplo n.º 1
0
        internal static SqlDbType GetSQLDataType(SqlNativeTypes nativeType)
        {
            switch (nativeType)
            {
            case SqlNativeTypes.bigint: return(SqlDbType.BigInt);

            case SqlNativeTypes.binary: return(SqlDbType.Binary);

            case SqlNativeTypes.bit: return(SqlDbType.Bit);

            case SqlNativeTypes.@char: return(SqlDbType.Char);

            case SqlNativeTypes.date: return(SqlDbType.Date);

            case SqlNativeTypes.datetime: return(SqlDbType.DateTime);

            case SqlNativeTypes.datetime2: return(SqlDbType.DateTime2);

            case SqlNativeTypes.datetimeoffset: return(SqlDbType.DateTimeOffset);

            case SqlNativeTypes.@decimal: return(SqlDbType.Decimal);

            case SqlNativeTypes.@float: return(SqlDbType.Float);

            //SqlNativeTypes.geography
            //SqlNativeTypes.geometry
            //SqlNativeTypes.hierarchyid
            case SqlNativeTypes.image: return(SqlDbType.Image);

            case SqlNativeTypes.@int: return(SqlDbType.Int);

            case SqlNativeTypes.money: return(SqlDbType.Money);

            case SqlNativeTypes.nchar: return(SqlDbType.NChar);

            case SqlNativeTypes.ntext: return(SqlDbType.NText);

            case SqlNativeTypes.numeric: return(SqlDbType.Decimal);

            case SqlNativeTypes.nvarchar: return(SqlDbType.NVarChar);

            case SqlNativeTypes.real: return(SqlDbType.Real);

            case SqlNativeTypes.smalldatetime: return(SqlDbType.SmallDateTime);

            case SqlNativeTypes.smallint: return(SqlDbType.SmallInt);

            case SqlNativeTypes.smallmoney: return(SqlDbType.SmallMoney);

            case SqlNativeTypes.sql_variant: return(SqlDbType.Structured);

            //SqlNativeTypes.sysname
            case SqlNativeTypes.text: return(SqlDbType.Text);

            case SqlNativeTypes.time: return(SqlDbType.Time);

            case SqlNativeTypes.timestamp: return(SqlDbType.Timestamp);

            case SqlNativeTypes.tinyint: return(SqlDbType.TinyInt);

            //case SqlNativeTypes.: return SqlDbType.Udt;
            case SqlNativeTypes.uniqueidentifier: return(SqlDbType.UniqueIdentifier);

            case SqlNativeTypes.varbinary: return(SqlDbType.VarBinary);

            case SqlNativeTypes.varchar: return(SqlDbType.VarChar);

            //case SqlNativeTypes.: return SqlDbType.Variant;
            case SqlNativeTypes.xml: return(SqlDbType.Xml);

            default: throw new Exception("Unknown native SQL type '" + nativeType.ToString() + "'!");
            }
        }
Exemplo n.º 2
0
 internal static SqlDbType GetSQLDataType(SqlNativeTypes nativeType)
 {
     switch (nativeType)
     {
         case SqlNativeTypes.bigint: return SqlDbType.BigInt;
         case SqlNativeTypes.binary: return SqlDbType.Binary;
         case SqlNativeTypes.bit: return SqlDbType.Bit;
         case SqlNativeTypes.@char: return SqlDbType.Char;
         case SqlNativeTypes.date: return SqlDbType.Date;
         case SqlNativeTypes.datetime: return SqlDbType.DateTime;
         case SqlNativeTypes.datetime2: return SqlDbType.DateTime2;
         case SqlNativeTypes.datetimeoffset: return SqlDbType.DateTimeOffset;
         case SqlNativeTypes.@decimal: return SqlDbType.Decimal;
         case SqlNativeTypes.@float: return SqlDbType.Float;
         //SqlNativeTypes.geography
         //SqlNativeTypes.geometry
         //SqlNativeTypes.hierarchyid
         case SqlNativeTypes.image: return SqlDbType.Image;
         case SqlNativeTypes.@int: return SqlDbType.Int;
         case SqlNativeTypes.money: return SqlDbType.Money;
         case SqlNativeTypes.nchar: return SqlDbType.NChar;
         case SqlNativeTypes.ntext: return SqlDbType.NText;
         case SqlNativeTypes.numeric: return SqlDbType.Decimal;
         case SqlNativeTypes.nvarchar: return SqlDbType.NVarChar;
         case SqlNativeTypes.real: return SqlDbType.Real;
         case SqlNativeTypes.smalldatetime: return SqlDbType.SmallDateTime;
         case SqlNativeTypes.smallint: return SqlDbType.SmallInt;
         case SqlNativeTypes.smallmoney: return SqlDbType.SmallMoney;
         case SqlNativeTypes.sql_variant: return SqlDbType.Structured;
         //SqlNativeTypes.sysname
         case SqlNativeTypes.text: return SqlDbType.Text;
         case SqlNativeTypes.time: return SqlDbType.Time;
         case SqlNativeTypes.timestamp: return SqlDbType.Timestamp;
         case SqlNativeTypes.tinyint: return SqlDbType.TinyInt;
         //case SqlNativeTypes.: return SqlDbType.Udt;
         case SqlNativeTypes.uniqueidentifier: return SqlDbType.UniqueIdentifier;
         case SqlNativeTypes.varbinary: return SqlDbType.VarBinary;
         case SqlNativeTypes.varchar: return SqlDbType.VarChar;
         //case SqlNativeTypes.: return SqlDbType.Variant;
         case SqlNativeTypes.xml: return SqlDbType.Xml;
         default: throw new Exception("Unknown native SQL type '" + nativeType.ToString() + "'!");
     }
 }