示例#1
0
        public PropertyField
        (
            string tableSchema
            , string tableName
            , string columnName
            , string dataType
            , int?length
            , int?numericScale
            , int?numericPrecision
            , object columnDefault
            , string columnText
            , string columnHeading
            , bool?isNullable
            , string hasDefault
            , bool isKey
        )
        {
            TableSchema      = tableSchema;
            TableName        = tableName;
            ColumnName       = columnName;
            IsNullable       = isNullable.GetValueOrDefault(true); //isNullable == "Y"; //none of them are nullable
            DataType         = dataType;                           //e.AsDb2Type().GetValueOrDefault(DB2Type.VARCHAR).AsCSharpType(IsNullable);
            Length           = length;
            NumericScale     = numericScale;
            NumericPrecision = numericPrecision;
            ColumnDefault    = columnDefault;
            ColumnText       = columnText;
            ColumnHeading    = columnHeading;
            IsKey            = isKey;
            HasDefault       = hasDefault == "Y";//.AsBoolean(); //all of our db2fields have defaults that I've seen

            ValidationAttributes = new ReadOnlyCollection <string>(new List <string>()
            {
                IsKey.AsKeyAttribute()
                , IsNullable.AsRequiredAttribute()
                , DataType.AsStringLengthAttribute(Length)
                , ColumnName.AsColumnAttribute()
            }.Where(s => !string.IsNullOrWhiteSpace(s)).ToList());
        }