Dashing.Extensions.TypeExtensions.GetDbType C# (CSharp) Method

GetDbType() public static method

The get db type.
///
public static GetDbType ( this type ) : DbType
type this /// The type. ///
return DbType
        public static DbType GetDbType(this Type type) {
            if (type.IsNullable()) {
                type = type.GetGenericArguments()[0];
            }

            if (TypeMap.ContainsKey(type)) {
                return TypeMap[type];
            }

            // just use underlying type of enum
            if (!type.IsEnum) {
                throw new ArgumentOutOfRangeException("type", "Unable to determine the DBType for type: " + type.FullName);
            }

            var enumType = Enum.GetUnderlyingType(type);
            if (TypeMap.ContainsKey(enumType)) {
                return TypeMap[enumType];
            }

            throw new ArgumentOutOfRangeException("type", "Unable to determine the DBType for type: " + type.FullName);
        }