如何在EntityFrameworkCore 1.0 rc2 中实现字段decimal(5,2)? [英] How to implement the field decimal(5,2) in EntityFrameworkCore 1.0 rc2?

查看:28
本文介绍了如何在EntityFrameworkCore 1.0 rc2 中实现字段decimal(5,2)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

HasPrecision 好像不能用了?

推荐答案

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

I'm seeing some examples like this:

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

支持此功能的代码在这里,因此希望您使用的版本支持此功能:

and the code to support this is here, so hopefully this is supported in the version you're using:

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

这篇关于如何在EntityFrameworkCore 1.0 rc2 中实现字段decimal(5,2)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆