public static async Task <List <T> > ToListAsyncOk <T>(
     this IQueryable <T> query,
     CancellationToken cancellationToken = default)
 =>
 query.Provider.GetType() == typeof(NHibernate.Linq.DefaultQueryProvider) ?
 await LinqExtensionMethods.ToListAsync(query, cancellationToken)
     :
 query.ToList();
Example #2
0
        private Task <IList> ToListAsync(dynamic queryable, CancellationToken cancellationToken)
        {
            return(queryable is INhQueryProvider?ToListAsyncInternal() : Task.FromResult <IList>(ToList(queryable)));

            async Task <IList> ToListAsyncInternal()
            {
                return(await LinqExtensionMethods.ToListAsync(queryable, cancellationToken));
            }
        }
Example #3
0
 public Task <List <TSource> > ToListAsync <TSource>(IQueryable <TSource> source, CancellationToken cancellationToken = default(CancellationToken))
 => LinqExtensionMethods.ToListAsync(source, cancellationToken);