locked
generic repository and multiple column sort RRS feed

  • Question

  • User828542847 posted

    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

    Wednesday, September 13, 2017 9:50 AM

All replies