Esempio n. 1
0
        public static bool TryCreate(string dbType, out FloatingPointMsSqlColumnType returnValue)
        {
            switch (dbType)
            {
            case "real":
                returnValue = new FloatingPointMsSqlColumnType(FloatingTypes.Real);
                return(true);

            case "float":
                returnValue = new FloatingPointMsSqlColumnType(FloatingTypes.Float);
                return(true);

            default:
                returnValue = null;
                return(false);
            }
        }
Esempio n. 2
0
        public static MsSqlColumnType Create(string databaseType)
        {
            var dbType = databaseType.ToLowerInvariant();

            if (IntegerMsSqlColumnType.TryCreate(dbType, out var integerType))
            {
                return(integerType);
            }

            if (FloatingPointMsSqlColumnType.TryCreate(dbType, out var floatingType))
            {
                return(floatingType);
            }

            if (DecimalMsSqlColumnType.TryCreate(dbType, out var decimalType))
            {
                return(decimalType);
            }

            if (DateTimeMsSqlColumnType.TryCreate(dbType, out var dateTimeType))
            {
                return(dateTimeType);
            }

            if (VarCharMsSqlColumnType.TryCreate(dbType, out var varcharType))
            {
                return(varcharType);
            }

            if (TextMsSqlColumnType.TryCreate(dbType, out var textType))
            {
                return(textType);
            }

            throw new NotImplementedException($"The database type \'{dbType}\' is not yet supported");
        }