public static async Task <T> GetByIdAsync <T, TId>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository, TId id,
                                                           CancellationToken cancellationToken = default(CancellationToken))
            where T : IHasId <TId>
        {
            var lambda = EntityExpressionUtils.CreateIdPropertyEqualsConstExpression <T, TId>(id);

            T t = await queryable.Where(lambda).FirstOrDefaultAsync(repository, cancellationToken);

            RepositoryHelpers.ThrowIfGetFailed(t, id);

            return(t);
        }
 public static Task <Dictionary <TKey, TElement> > ToDictionaryAsync <T, TKey, TElement>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository,
                                                                                         Func <T, TKey> keySelector, Func <T, TElement> elementSelector, IEqualityComparer <TKey> comparer, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToDictionaryAsync(queryable, keySelector, elementSelector, comparer, cancellationToken));
 }
 public static Task <Dictionary <TKey, T> > ToDictionaryAsync <T, TKey>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository, Func <T, TKey> keySelector,
                                                                        CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToDictionaryAsync(queryable, keySelector, cancellationToken));
 }
 public static Task <List <T> > ToListAsync <T>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository,
                                                CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToListAsync(queryable, cancellationToken));
 }
 public static IQueryable <T> Include <T>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository,
                                          string navigationPropertyPath) where T : class
 {
     return(repository.Include(queryable, navigationPropertyPath));
 }
 public static IQueryable <T> Include <T, TProperty>(this IQueryable <T> queryable,
                                                     IQueryableExtensionsResolver repository,
                                                     Expression <Func <T, TProperty> > navigationPropertyPath) where T : class
 {
     return(repository.Include(queryable, navigationPropertyPath));
 }