c# - 如何在 EntityFrameworkCore 1.0 rc2 中实现字段 decimal(5,2)?

标签 c# entity-framework-core

如何在EntityFrameworkCore 1.0 rc2中实现字段decimal(5,2)

HasPrecision 好像不能用了?

最佳答案

我看到了一些这样的例子:

 entityBuilder.Property(r => r.TotalScore)
            .HasColumnType("decimal(5,2)")
            .IsRequired(true);

支持它的代码在这里,所以希望你使用的版本支持它:

https://github.com/aspnet/EntityFramework/blob/f416dd9a71a5a6a69715b4ba40a37e6f9da751ef/src/Microsoft.EntityFrameworkCore.Relational/Metadata/Internal/RelationalPropertyBuilderAnnotations.cs

关于c# - 如何在 EntityFrameworkCore 1.0 rc2 中实现字段 decimal(5,2)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37400828/

相关文章:

c# - 如何在 IDesignTimeServices 中正确使用 IPluralizer

c# - 不支持使用 let 关键字的 Entity Framework Core 5?

c# - UPS WSDL/C# 示例编译错误

c# - 使用泛型方法返回 list<T>,其中 T 可以是共享相同结构的三种类型之一

c# - 从 HTML <figure> 和 <figcaption> 到 Microsoft Word

mysql - 实体类型 'IdentityUser' 是层次结构的一部分,但没有配置鉴别器值

c# - 与 EF Core 联合返回无法转换集合操作,因为两个操作数具有不同的 'Include' 操作

C# 正则表达式 : Combine a look ahead regex and a look behind regex into one

c# - WPF 错误 : "Cannot find governing FrameworkElement or Framework..."

.net-core - Entity Framework 核心和 UseInMemoryDatabase