I have already searched for archives, but cannot find a solution that works for linq for sql.
How to create custom order in linq for sql so that it generates SQL code like this
ORDER BY
CASE SEASON
WHEN 'WINTER' THEN 1
WHEN 'SPRING' THEN 2
WHEN 'SUMMER' THEN 3
WHEN 'AUTUMN' THEN 4
END
Note that custom comparators do not seem to compile, but OrderByWeight, as seen from this tutorial ( http://www.skindog.co.uk/2009/03/18/custom-sorting-order-in-linq-order -by-weighting / ) doesn't seem to exist
Note
I want the order to be executed on the sql server, and not in C #, as this will give me different results, as I am splitting my results.
source
share