有下面这么个Linq to entity传入参数int[] idList,希望让ObjectQuery在数组查询,实现In操作,是这么写的: ObjectQuery<Application> query = MainDbGateway.Select<Application>("SELECT Value app from BridgeMain." + MainDbGateway.ApplicationSetName + " as app");query = (ObjectQuery<Application>)query.Where(a => idList.Any(i => i == a.ApplicationID));return query.Execute(MergeOption.NoTracking).ToList(); 编译没问题,可惜运行时就遭遇了异常: “System.NotSupportedException was unhandled by user codeMessage="Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context."Source="System.Data.Entity"” 请问应该怎么写啊??
1 回答
- 1 回答
- 0 关注
- 270 浏览
添加回答
举报
0/150
提交
取消