Skip to content

DynamicCriteria

Hamed ZVand edited this page Jul 30, 2020 · 1 revision

Dynamic extensions in Alamut.Data help you to filter and sort an IQuaryable data provider.

  • Filtering
    _dbContext.Blogs.Filter("Id == @0", 1)

  • Sorting
    _dbContext.Blogs.Sort("Id desc")

  • DynamicCriteria

_dbContext.Blogs.ApplyCriteria(new DynamicCriteria
{
 Sorts = "Id desc",
 FilterClause = "Id > @0",
 FilterParameters = new object[] {10}
})
var criteria = new DynamicPaginatedCriteria
{
    Sorts = "Id desc",
    FilterClause = "Id > @0",
    FilterParameters = new object[] {10},
    CurrentPage = 2, 
    PageSize = 3
};
_dbContext.Blogs.ToPaginated(criteria);

It's worth to take a look at test scenarios

Clone this wiki locally