mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 ColumnAttribute Precision/Scale 设置;
This commit is contained in:
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user