I'm trying to sort a list of products by their price.
The result set needs to list products by price from low to high by the column
var products = from p in _context.Products
where p.ProductTypeId == 1
orderby p.LowestPrice.HasValue descending
orderby p.LowestPrice descending
// returns: 102, 101, 100, null, null
// i'd like: 100, 101, 102, null, null
Try putting both columns in the same orderby.
orderby p.LowestPrice.HasValue descending, p.LowestPrice
Otherwise each orderby is a separate operation on the collection re-ordering it each time.
This should order the ones with a with a value first, "then" the order of the value.