No applicable aggregate method 'OrderByDescending' exists'

c# dynamic-linq linq

Question

in the regular linq its fine, but in dynamic linq doesnt have this method, how can i find a solution Here is my error code in dynamic linq

q = " CRM_ASSENTAMENTOS.Count > 0 && CRM_ASSENTAMENTOS.OrderByDescending(ID_ASSENTAMENTO).FirstOrDefault().ID_PRIORIDADE == 2";
ocorrencias = ocorrencias.Where(q);

and my regular linq

ocorrencias = ocorrencias.Where(o => o.CRM_ASSENTAMENTOS.OrderByDescending(a => a.ID_ASSENTAMENTO).FirstOrDefault().ID_PRIORIDADE == 2);
1
1
5/4/2018 2:41:14 PM

Popular Answer

The inline OrderByDescending(...) is supported by System.Linq.Dynamic.Core

For an example see this QueryableTests.OrderByDescending.cs#L36

Can you try that NuGet library?

0
9/21/2018 1:12:17 PM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow