Esempio n. 1
0
        private static string GetColumnType(DbTypeEx dbType)
        {
            var length = dbType.MaxLength?.ToString() ?? "MAX";

            switch (dbType.Type)
            {
            case DbType.AnsiStringFixedLength:
                return("CHAR(" + length + ")");

            case DbType.Binary:
                return("VARBINARY(" + length + ")");

            case DbType.String:
                return("NVARCHAR(" + length + ")");

            case DbType.StringFixedLength:
                return("NCHAR(" + length + ")");

            default:
                var index = (int)dbType.Type;
                if (index >= 0 && index < ColumnTypes.Length)
                {
                    var result = ColumnTypes[index];
                    if (result != null)
                    {
                        return(result);
                    }
                }

                throw new NotSupportedException("Unknown DbType: " + dbType.Type);
            }
        }
        private static string GetColumnType(DbTypeEx dbType)
        {
            switch (dbType.Type)
            {
            case DbType.AnsiStringFixedLength:
                return("TEXT");

            case DbType.Binary:
                return("BYTEA");

            case DbType.String:
                return("TEXT");

            case DbType.StringFixedLength:
                return("TEXT");

            default:
                var index = (int)dbType.Type;
                if (index >= 0 && index < ColumnTypes.Length)
                {
                    var result = ColumnTypes[index];
                    if (result != null)
                    {
                        return(result);
                    }
                }

                throw new NotSupportedException("Unknown DbType: " + dbType.Type);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ColumnSchema"/> class.
 /// </summary>
 public ColumnSchema(
     string columnName,
     string selectName,
     string parameterName,
     ColumnUsage usage,
     DbTypeEx columnType)
 {
     this.ColumnName    = columnName;
     this.SelectName    = selectName;
     this.ParameterName = parameterName;
     this.Usage         = usage;
     this.ColumnType    = columnType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ColumnSchema"/> class.
 /// </summary>
 public ColumnSchema(
     int index,
     string propertyName,
     string columnName,
     string selectName,
     string parameterName,
     ColumnUsage usage,
     DbTypeEx columnType)
 {
     this.Index         = index;
     this.PropertyName  = propertyName;
     this.ColumnName    = columnName;
     this.SelectName    = selectName;
     this.ParameterName = parameterName;
     this.Usage         = usage;
     this.ColumnType    = columnType;
 }