Extends IQueryable interface.
Sort elements with filed name that Use OderBy, OrderByDescending, ThenBy, ThenByDescending methods.
Signature:
Sort(string fileName, bool isAscending)
Example code:
See Example project. example/Example.App
using(var ctx = new ExampleDbContext()){
var result =ctx.Documents.Sort(nameof(Document.Content)).Sort(nameof(Document.Id), false);
}
public class DocumentModel
{
}
public class DocumentPagedModel : PagedModel<DocumentModel>
{
}
//
var page = 1;
var limit = 10;
using(var ctx = new ExampleDbContext()){
var result =ctx.Documents
.Select(x => new DocumentModel
{
//
})
.ToPagedModel<DocumentModel,DocumentPagedModel>(page, limit);
var items = result.Items; // You got paged items.
}
Follow the .net license and the Microsoft.EntityFrameworkCore license.