I need to write the following SQL statement in LINQ lambdas:
SELECT *
FROM product
ORDER BY ProductScore DESC, ProductID ASC
I guess this code:
product.OrderByDescending(m => m.ProductScore).OrderBy(m => m.ProductId)
it is not equivalent since the second OrderBy will overwrite the first one. Is there any equivalent? Thanks
Use the
ThenBymethod:There’s also a
ThenByDescendingmethod.