问题描述
我有一些使用 XrmToolbox 构建的早期实体,使用 IQueryable 数据集,尝试提取一些案例标题,其中案例未链接到另一个实体。尝试了这两种方法,它们产生了几乎相同的错误:
if (cases.Where(x => !serviceContext.new_casegroupSet.Any(y => y.new_case.Id == x.IncidentId)).ToList().Count() > 0)
{
throw new InvalidPluginExecutionException(OperationStatus.Canceled,$"Case/s missing Groups: \"{(cases.Where(x => !serviceContext.new_casegroupSet.Any(y => y.new_case.Id == x.IncidentId)).Select(x => x.Title).ToList())}\"");
}
和
if (cases.Where(x => serviceContext.new_casegroupSet.Where(y => y.new_case.Id == x.IncidentId).ToList().Count() == 0).ToList().Count() > 0)
{
throw new InvalidPluginExecutionException(OperationStatus.Canceled,$"Case/s missing Groups: \"{(cases.Where(x => serviceContext.new_casegroupSet.Where(y => y.new_case.Id == x.IncidentId).ToList().Count() == 0).Select(x => x.Title).ToList())}\"");
}
错误是:Invalid 'where' condition. An entity member is invoking an invalid property or method.
我没有嵌套 Where() 或 Any() 的任何这些似乎工作正常,但 Any() 实际上似乎根本不起作用。
这甚至可能吗?或者我是否必须先获取案例并遍历它们以在链接实体中匹配?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)