I have the following code to construct a SORT query inside a foreach loop, however my problem is this will replace my old sort descriptor with latest one.
SearchDescriptor<MyDTO> nQuery = new SearchDescriptor<MyDTO>();
foreach (var sort in criteria.SortQuery.OrderBy(o => o.SortPreference))
{
nQuery= nQuery.Sort(s => s.Field(sort.SortName, sort.SortOrder));
}
How to achieve this inside a ForEach