Exemple #1
0
        public static bool TryCreate(string dbType, out TextMsSqlColumnType returnValue)
        {
            bool isUnicode;

            var curDbType = dbType;

            if (curDbType.StartsWith("n"))
            {
                isUnicode = true;
                curDbType = curDbType.Substring(1);
            }
            else
            {
                isUnicode = false;
            }

            if (curDbType == "text")
            {
                returnValue = new TextMsSqlColumnType(isUnicode);
                return(true);
            }

            returnValue = null;
            return(false);
        }
Exemple #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");
        }