无法将类型“System.Int32”强制转换为“System.Object”类型。 LINQ to Entities仅支持转换实体数据模型基元类型
我正在使用LINQ to Entities,我在运行时收到以下错误。 “无法将类型'System.Int32'强制转换为'System.Object'.LINQ to Entities仅支持转换实体数据模型基元类型”。
LINQ语句如下所示:
(From item In _EntityObject.SystemUsers
Where item.Username = UsernameValue And
Not Equals(item.ID, IDValue)
Select item.Active).Count
当IDValue设置为Nothing时,查询执行完美,而当我将值设置为Integer时,我收到上述错误。 item.ID是Integer类型的属性,而IDValue的类型是Nullable(Of Integer)。
我有相同的LINQ查询,我在其他地方使用的不同字段完美地工作。
(From item In _EntityObject.Languages
Where item.Reference = Reference And
Not Equals(item.ID, ID)
Select item.Name).Count
没有找到相关结果
已邀请:
2 个回复
车料
标志
浆错