我的asp.net mvc应用程序中有以下代码: -
var result = from userContactInfo in entities.AaaUserContactInfoes
join contactInfo in entities.AaaContactInfoes on userContactInfo.CONTACTINFO_ID equals contactInfo.CONTACTINFO_ID
where organizationNames.Any(orgName => contactInfo.EMAILID.Split('@')[1].Split('.')[0].Contains(orgName))
select userContactInfo;
但是我收到以下错误: -
The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.
那么可能导致此错误的原因是什么?
答案 0 :(得分:4)
如评论中所述,构建EF查询时不能使用数组。要解决这个问题,我建议在where子句中尝试以下技巧:
where organizationNames.Any(orgName => contactInfo.EMAILID.Contains("@" + orgName + "."))