I have a generic class with a method that needs to sort a generic entity.
However, an error occurs saying that it does not recognize the Reflection GetProperty method, since lambda can not translate.
How can I do this sort ordering logic?
public IEnumerable<TEntity> GetAll()
{
var obj = _repository.GetAll()
.OrderByDescending(x => x.GetType().GetProperty(typeof(TEntity).Name + "Id"));
return obj.Pagination();
}
Here is the error image:
Aucun commentaire:
Enregistrer un commentaire