【发布时间】:2013-06-06 13:37:25
【问题描述】:
我得到的错误是这样的:
The 'SalesValue' property on 'ItemSale' could not be set to a 'Decimal' value.
You must set this property to a non-null value of type 'Single'.
但我已经这样做了:
[Table("ItemSales")]
public class ItemSale {
[Key]
public int ID { get; set; }
....
public Single SalesValue { get; set; }
}
这是我的 LINQ,很简单:
from x in database.ItemSales
select x
我首先使用实体框架代码
我该如何解决这个问题?
【问题讨论】:
-
这是代码优先吗?也许您的数据库已经存在并且数据类型不同
-
是的,这是 EF-Code First。数据库使用此处定义的“ItemSale”对象,因此不会有什么不同。
标签: c# linq-to-sql ef-code-first