- 增加 ColumnAttribute Precision/Scale 设置;

This commit is contained in:
28810
2020-07-31 03:07:13 +08:00
parent af153295f8
commit 73c87513d2
9 changed files with 235 additions and 163 deletions

View File

@ -104,5 +104,16 @@ namespace FreeSql.DataAnnotations
/// 注意:如果是 getdate() 这种请可考虑使用 ServerTime因为它对数据库间作了适配
/// </summary>
public string InsertValueSql { get; set; }
internal int? _Precision;
/// <summary>
/// decimal/numeric 类型的长度
/// </summary>
public int Precision { get => _Precision ?? 0; set => _Precision = value; }
internal int? _Scale;
/// <summary>
/// decimal/numeric 类型的小数位长度
/// </summary>
public int Scale { get => _Scale ?? 0; set => _Scale = value; }
}
}

View File

@ -176,5 +176,18 @@ namespace FreeSql.DataAnnotations
_column.InsertValueSql = value;
return this;
}
/// <summary>
/// decimal/numeric 类型的长度/小数位长度
/// </summary>
/// <param name="precision">总长度</param>
/// <param name="scale">小数位长度</param>
/// <returns></returns>
public ColumnFluent Precision(int precision, int scale = 0)
{
_column.Precision = precision;
_column.Scale = scale;
return this;
}
}
}