为了账号安全,请及时绑定邮箱和手机立即绑定

ADO.NET Entity framework的查询问题

ADO.NET Entity framework的查询问题

智慧大石 2018-11-13 05:02:30
有下面这么个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 关注
  • 261 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信