In my C# application, I have a collection of objects which have an int Order property ranging from 1 to n.
When I do like this:
var listings = session.Query<Listing>().Where(x => !x.IsDeleted && x.CategoryId == category.Id && x.WorkflowStatus == WorkflowStatus.Published).OrderBy(x => x.Order);
I get a collection of listings but not 100% in the correct order. As it stands the order goes:
0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 28, 29, 3, 30, 31, 32, 33, 4 ....
Any idea why the OrderBy doesn't do exactly as it should?
Orderproperty to be a string instead of an int, that's how it would be ordered if they were text. - Colm PruntyOrderBy(x => (int)x.Order);but I'm not sure why it's returning as string if it's supposed to be stored as an int. - Colm Prunty