Recently, I have a project that made with ef core, and every time I added some property I have to create a new condition for soring it, so I want to sort the entity with a string or with some mark that could be used as default sorting, so I created this solution to manage this problem.
I was guiding by ZZZ Projects's System.Linq.Dynamic.Core
Using dotnet cli
dotnet add package AutoSort.NetCore
Or package manager
Install-Package AutoSort.NetCore
When applying the sort but didn't pass parameter ordering
it will take configuration of model.
using NetCore.AutoSort;
public Hero
{
// this will be the last sort and ascending
[Sort(2)]
public int Id { get; set; }
// this will be sort first one and descending
[Sort(SortDirection.Descending)]
public string Name { get; set; }
// this will sort in second one ascending
[Sort(1)]
public string History { get; set; }
}
More example in AutoSort.Example
This project is licensed under the MIT License - see the LICENSE file for details