相关疑难解决方法(0)

EF Core 6 小数精度警告

升级到 EF Core 6 后,在添加迁移时,我遇到了这个恼人的警告:

No store type was specified for the decimal property '{property}' on entity type '{entityType}'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accommodate all the values in 'OnModelCreating' using 'HasColumnType', specify precision and scale using 'HasPrecision', or configure a value converter using 'HasConversion'.
Run Code Online (Sandbox Code Playgroud)

此处定义: https: //github.com/dotnet/efcore/blob/main/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs

我不确定是否理解此警告的目的,因为带有标签的实体 [Keyless]并不存在于数据库中。另外添加诸如 之类的属性似乎 [Column(TypeName = "decimal(28, 6)")]并不能清除有关无密钥实体的警告。

entity-framework-core

19
推荐指数
1
解决办法
8471
查看次数

标签 统计

entity-framework-core ×1