Posted on 2008-10-09
I know there is way to build linq dynamicalli with Expression class and i was struggling for hours to make following code dynamic:
public IQueryable<T> OrderByGuid<T>(IQueryable<T> query, string fieldName) where T : Ii18n
return query.OrderBy(x => x.i18ns.SingleOrDefault(
y => y.LanguageID == CurrentLanguageID && y.ValueID == x.X).Value);
The idea is that i have lists that contain language-dependent columns and when i order by that column, I want it to be ordered by the value of current language.