I have a table valued function that I'm calling with a LINQ query.
As I now understand it (as referenced here), the sorting needs to be done outside of the table valued function. This means, I have to do it in the LINQ query.
I need some assistance with the syntax. Here's my original call to the function.
var sourceQuery = (from f in db.fGameListDataTable(competitionID, eventID, participantType)
select f);
I need to take this custom sorting from the SQL query and add it to the LINQ query.
Order By
CASE
WHEN GameType = 'G' THEN '1'
WHEN GroupNumber = '1' THEN '2'
WHEN GroupNumber = '2' THEN '3'
WHEN GroupNumber = '3' THEN '4'
WHEN GroupNumber = '4' THEN '5'
WHEN GameType = 'GT' THEN '6'
WHEN GameType = 'P' THEN '7'
WHEN GameType = 'FT' THEN '8'
END ASC,
g.GameID ASC
UPDATE
For a visual reference, here's the table that getting sorted. Note the order.