升级到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'.
我不确定理解这个警告的目的,因为带有[Keyless]
标记的实体不存储在数据库中。另外,添加类似[Column(TypeName = "decimal(28, 6)")]
的属性似乎不能消除关于keyless实体的警告。