【发布时间】:2019-03-12 07:09:45
【问题描述】:
在 asp.net 5+ 中使用 EF6 代码优先,我如何存储具有 3 个小数点的十进制值?
即,我的字段需要能够存储 272.724
目前我有:
[DataType(DataType.Currency)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:c}")]
[DisplayName("Report Fee")]
public decimal ReportFee { get; set; }
我已经尝试添加:
[Column(TypeName = "decimal(18,3)")]
但我得到了错误:
The store type 'decimal(18,3)' could not be found in the SqlServer provider manifest
【问题讨论】:
-
实体框架核心2?
-
抱歉,应该是 EF6。
-
STORE,用于以后的计算
-
这仍然是一个非常可疑的要求,应该在需要的地方和时间进行四舍五入,而不是在存储中。
-
只要使用
DataFormatString = "{0:c3}")
标签: c# asp.net entity-framework