コード例 #1
0
 public static Task <Dictionary <TKey, T> > ToDictionaryAsync <T, TKey>(this IQueryable <T> queryable, IAsyncQueryableResolver repository, Func <T, TKey> keySelector,
                                                                        CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToDictionaryAsync(queryable, keySelector, cancellationToken));
 }
コード例 #2
0
 public static Task <Dictionary <TKey, TElement> > ToDictionaryAsync <T, TKey, TElement>(this IQueryable <T> queryable, IAsyncQueryableResolver repository,
                                                                                         Func <T, TKey> keySelector, Func <T, TElement> elementSelector, IEqualityComparer <TKey> comparer, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToDictionaryAsync(queryable, keySelector, elementSelector, comparer, cancellationToken));
 }
コード例 #3
0
 public static Task <List <T> > ToListAsync <T>(this IQueryable <T> queryable, IAsyncQueryableResolver repository,
                                                CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.ToListAsync(queryable, cancellationToken));
 }
コード例 #4
0
 public static Task <long> LongCountAsync <T>(this IQueryable <T> queryable, IAsyncQueryableResolver repository,
                                              CancellationToken cancellationToken = default(CancellationToken))
 {
     return(repository.LongCountAsync(queryable, cancellationToken));
 }
コード例 #5
0
 public static IQueryable <T> Include <T>(this IQueryable <T> queryable, IAsyncQueryableResolver repository,
                                          string navigationPropertyPath) where T : class
 {
     return(repository.Include(queryable, navigationPropertyPath));
 }
コード例 #6
0
 public static IQueryable <T> Include <T, TProperty>(this IQueryable <T> queryable,
                                                     IAsyncQueryableResolver repository,
                                                     Expression <Func <T, TProperty> > navigationPropertyPath) where T : class
 {
     return(repository.Include(queryable, navigationPropertyPath));
 }
コード例 #7
0
        public static async Task <T> GetByIdAsync <T, TId>(this IQueryable <T> queryable, IAsyncQueryableResolver 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);
        }