I'm getting the exception: Method not supported: All on the last line, below:
private static Expression<Func<InstallationSummary, bool>> GetWhereClause(ApplicationServer appServer, ApplicationWithOverrideVariableGroup appWithGroup) { // If we're getting matches that include CustomVariableGroups (CVGs), then the number of CVGs and the IDs must match. return summary => summary.ApplicationServerId == appServer.Id && summary.ApplicationWithOverrideVariableGroup.ApplicationId == appWithGroup.Application.Id && summary.ApplicationWithOverrideVariableGroup != null && summary.ApplicationWithOverrideVariableGroup.CustomVariableGroupIds != null && summary.ApplicationWithOverrideVariableGroup.CustomVariableGroupIds.Count == appWithGroup.CustomVariableGroupIds.Count && summary.ApplicationWithOverrideVariableGroup.CustomVariableGroupIds.All(appWithGroup.CustomVariableGroupIds.Contains); } Is there another option to use instead of All(), or do I need to bring back the results and loop through them in memory?
public class ApplicationWithOverrideVariableGroup : EntityBase { // More code here public List<string> CustomVariableGroupIds { get; set; } // More code here }
InstallationSummaryclass so we can see whatCustomVariableGroupIdsis.Allcan always be replaced byAnywith a negated argument. If that's not supported, you can replace it byWherefollowed byAny(). Would that possibly help?AnyandAllare not supported inside expressions. Perhaps calling the Linq extension method manually would do the trick (i.e. transform theAllinto a plainCall-- though obviously this would require things to be in memory)?Allinstead? The way I see it, you are using theEnumerable.Allextension method, whereas the extension method that has a chance of working isQueryable.All. (That is, try writing.All(cvg => appWithGroup.CustomVariableGroupIds.Contains(cvg))