Aspnetboilerplate: Queryable.OrderBy

Created on 13 Dec 2016  路  1Comment  路  Source: aspnetboilerplate/aspnetboilerplate

Dears ;
I'm facing this problem ,Please help

`public class GetCardListInput: IPagedResultRequest, ISortedResultRequest
{
public int SkipCount { get; set; }
public int MaxResultCount { get; set; }
public string Sorting { get; set; }

}`

`public async Task> GetList(GetCardListInput input)
{
var cardsCount = 0;

        if (input.MaxResultCount <= 0)
        {
            input.MaxResultCount = SettingManager.GetSettingValue<int>(MySettingProvider.CardsDefaultPageSize);
        }
        cardsCount = await _cardRepository.CountAsync();

        var cards = await _cardRepository
           .GetAll()             
           .OrderBy(input.Sorting)
           .PageBy(input)
           .ToListAsync();
       return new PagedResultDto<CardListDto>(cardsCount, cards.MapTo<List<CardListDto>>());
    }`

then i got this error

The type arguments for method 'Queryable.OrderBy<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>)' cannot be inferred from the usage.

Thanx alot;

Most helpful comment

I found the issue

add using System.Linq.Dynamic;

>All comments

I found the issue

add using System.Linq.Dynamic;

Was this page helpful?
0 / 5 - 0 ratings