環(huán)境:sqlserver 2017 ,.net core 2.0,EF core 2.01.數(shù)據(jù)庫中字段類型是float的(可空),對應(yīng)實體類型也是用的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
提交
取消