Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

generic repository and multiple column sort

$
0
0

this is very simple way to sort by multiple column.

var qry = ctx.DestinationTimings.Where(x => x.DestinationID == this.ID)
                 .OrderBy(t => t.Date ?? DateTime.MaxValue)
                 .ThenBy(t => t.DayOfWeek)
                 .ThenBy(t => t.Time);

i like to know suppose when we work with generic repository then how could i sort multiple columns easy way. suppose first column asc order and next two columns desc order. suppose table has 10 columns.

please give me a easy and simple solution. thanks


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>