I want to sort data in DESC order. This is my code:
var predicate = Predicates.Sort<myPoco>(x => x.name, false);
var result = GetList<myPoco>(predicate).ToList();
protected IEnumerable<T> GetList<T>(object predicate, IList<ISort> sort = null, IDbTransaction transaction = null, int? commandTimeout = null, bool buffered = false) where T : class
{
var result = connection.GetList<T>(predicate, sort, transaction, commandTimeout, buffered);
return
}
Using Dapper Extensions, I am unable to sort data. The code above throws the following error:
PropertyName was not found for...
I am mapping myPoco
property using Dapper Extension's ClassMapper
.
You can sort data using ISort
in Dapper Extension's.
List<ISort> sortList = new List<ISort>();
sortList.Add(Predicates.Sort<myPoco>(x => x.Name, false));
var result = GetList<myPoco>(null, sortList).ToList();
return result;
protected IEnumerable<T> GetList<T>(object predicate, IList<ISort> sort = null, IDbTransaction transaction = null, int? commandTimeout = null, bool buffered = false) where T : class
{
var result = connection.GetList<T>(predicate, sort, transaction, commandTimeout, buffered);
return result;
}