I use [EnableQuery](System.Web.Http.OData) in ASP.NET API 2 controllers to enable OData v3 filtering / sorting / paging. I noticed that using a sentence $orderbyreturns data that is sorted as follows (here are a few examples - they are strings and do not necessarily have a template for them):
LoadTest1000_1
LoadTest1000_10
LoadTest1000_1000
LoadTest1000_2
LoadTest1000_20
[etc]
When I need a natural sort:
LoadTest1000_1
LoadTest1000_2
LoadTest1000_10
LoadTest1000_20
LoadTest1000_1000
LoadTest1000_2000
[etc]
How to enable this sorting? Are there any extensions that I could use to provide my own sorting logic?
source
share