Errore: LINQ alle entità non riconosce il metodo 'System.String Aggregate [String, String] (System.Collections.Generic.IEnumerable 1[System.String], System.String, System.Func
3 [System.String, System. String, System.String]) 'metodo, e questo metodo non può essere tradotto in un'espressione di archivio.La funzione aggregata nell'espressione LINQ genera errore. (non può essere tradotto in un'espressione di negozio.)
Linq Expression:
Items = context.TESTANSWER.Where(x => x.ID == 6729223232)
.Join(context.QUESTIONREPOs, x => x.QUESTIONID, y => y.ID, (x, y) => new { x = x, y = y })
.Join(context.OPTIONREPOs, p => p.x.QUESTIONID, q => q.QUESTIONID, (p, q) => new { p = p, q = q }).Where(p => p.p.x.RESPONSEID == p.q.ID)
.GroupJoin(context.TESTANSWERASSOCIATION, c => c.p.x.ID, b => b.TESTANSWERID, (c, b) => new { c = c, b = b })
.SelectMany(
n => n.b.DefaultIfEmpty(),
(n, b) =>
new QuestListItemObj
{
State = n.c.p.x.STATE,
Association = n.b.Select(l => l.ASSOCIATION.TITLE).ToList().Aggregate((s, t) => s + ", " + t),
Description = n.c.p.y.DESCRIPTION,
Question = n.c.p.y.QUESTION,
Answer = n.c.q.OPTIONTEXT,
}).ToList();
Inoltre ho appena provato SelectMany ma ho ottenuto lo stesso errore ..
Affiliaiton = n.b.SelectMany(l => l.AFFILIATION.TITLE).Aggregate(string.Empty, (s, t) => s + ", " + t),