为了账号安全,请及时绑定邮箱和手机立即绑定

数据库插不进数据

初始化服务器那里显示下面的警告,在初始化方法那里把price做了显示类型转换也不行还是显示警告,把noodle类的price类型改成int之后,警告倒是没有了,但还是插不进数据

warn: Microsoft.EntityFrameworkCore.Model.Validation[30000]

      No type was specified for the decimal column 'Price' on entity type 'Noodle'. 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 using 'ForHasColumnType()'.


正在回答

1 回答

问题解决了,这个警告是个小问题,https://mattferderer.com/entity-framework-no-type-was-specified-for-the-decimal-column,这里有解决方法,

原来是我的main里面调用的是Seed(),然后初始化器里面写的seed(),然后不知道什么时候vs给我创建了一个空Seed(),然后一直调用的是空Seed(),真的是阴差阳错,头疼啊

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

数据库插不进数据

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信