环境:sqlserver 2017 ,.net core 2.0,EF core 2.01.数据库中字段类型是float的(可空),对应实体类型也是用的float的(可空),程序启动起来就报错,日志详情为:An exception occurred while reading a database value for property 'XXXXXX'. The expected type was 'System.Nullable`1[System.Single]' but the actual value was of type 'System.Double'. ---> System.InvalidCastException: Unable to cast object of type 'System.Double' to type 'System.Nullable`1[System.Single]'.于是我把字段类型改为Double解决了。很好奇这个问题的原因是什么??还有顺便问一下double和Double有什么不同??
添加回答
举报
0/150
提交
取消