I have the following Linq statement, which works totally fine:
query = query.OrderBy(m => m.MATERIAL_TXT.Where(mt => mt.LANG == "EN").FirstOrDefault().LTEXT);
Now I'm trying to make it dynamic by using the string based syntax from Linq.Dynamic:
query = query.OrderBy("MATERIAL_TXT.Where(LANG==\"EN\").FirstOrDefault().LTEXT");
But it throws the exception :
"No applicable aggregate method 'FirstOrDefault' exists"
It has to bedynamic so that it accepts other names instead of "MATERIAL_TXT".
What am I missing?