System.Data.SqlClient.MetaType.GetMetaTypeFromType C# (CSharp) Method

GetMetaTypeFromType() static private method

static private GetMetaTypeFromType ( Type dataType, bool streamAllowed = true ) : MetaType
dataType System.Type
streamAllowed bool
return MetaType
        static internal MetaType GetMetaTypeFromType(Type dataType, bool streamAllowed = true)
        {
            if (dataType == typeof(System.Byte[]))
                return MetaVarBinary;
            else if (dataType == typeof(System.Guid))
                return s_metaUniqueId;
            else if (dataType == typeof(System.Object))
                return s_metaVariant;
            else if (dataType == typeof(SqlBinary))
                return MetaVarBinary;
            else if (dataType == typeof(SqlBoolean))
                return s_metaBit;
            else if (dataType == typeof(SqlByte))
                return s_metaTinyInt;
            else if (dataType == typeof(SqlBytes))
                return MetaVarBinary;
            else if (dataType == typeof(SqlChars))
                return MetaNVarChar;
            else if (dataType == typeof(SqlDateTime))
                return s_metaDateTime;
            else if (dataType == typeof(SqlDouble))
                return s_metaFloat;
            else if (dataType == typeof(SqlGuid))
                return s_metaUniqueId;
            else if (dataType == typeof(SqlInt16))
                return s_metaSmallInt;
            else if (dataType == typeof(SqlInt32))
                return s_metaInt;
            else if (dataType == typeof(SqlInt64))
                return s_metaBigInt;
            else if (dataType == typeof(SqlMoney))
                return s_metaMoney;
            else if (dataType == typeof(SqlDecimal))
                return MetaDecimal;
            else if (dataType == typeof(SqlSingle))
                return s_metaReal;
            else if (dataType == typeof(SqlXml))
                return MetaXml;
            else if (dataType == typeof(SqlString))
                return MetaNVarChar;
            else if (dataType == typeof(IEnumerable<DbDataRecord>))
                return s_metaTable;
            else if (dataType == typeof(TimeSpan))
                return MetaTime;
            else if (dataType == typeof(DateTimeOffset))
                return MetaDateTimeOffset;
            else if (dataType == typeof(DBNull))
                throw ADP.InvalidDataType(nameof(DBNull));
            else if (dataType == typeof(Boolean))
                return s_metaBit;
            else if (dataType == typeof(Char))
                throw ADP.InvalidDataType(nameof(Char));
            else if (dataType == typeof(SByte))
                throw ADP.InvalidDataType(nameof(SByte));
            else if (dataType == typeof(Byte))
                return s_metaTinyInt;
            else if (dataType == typeof(Int16))
                return s_metaSmallInt;
            else if (dataType == typeof(UInt16))
                throw ADP.InvalidDataType(nameof(UInt16));
            else if (dataType == typeof(Int32))
                return s_metaInt;
            else if (dataType == typeof(UInt32))
                throw ADP.InvalidDataType(nameof(UInt32));
            else if (dataType == typeof(Int64))
                return s_metaBigInt;
            else if (dataType == typeof(UInt64))
                throw ADP.InvalidDataType(nameof(UInt64));
            else if (dataType == typeof(Single))
                return s_metaReal;
            else if (dataType == typeof(Double))
                return s_metaFloat;
            else if (dataType == typeof(Decimal))
                return MetaDecimal;
            else if (dataType == typeof(DateTime))
                return s_metaDateTime;
            else if (dataType == typeof(String))
                return MetaNVarChar;
            else
                throw ADP.UnknownDataType(dataType);
        }