private async IAsyncEnumerator <T> GetAsyncEnumeratorInternal(IAsyncQueryProvider provider, CancellationToken cancellationToken = default) { var enumerable = (IEnumerable <T>) await provider.ExecuteAsync <Task <object> >(_expression, cancellationToken); foreach (var element in enumerable) { yield return(element); } }
private async Task <object> ExecuteExpressionAsync <T>(CancellationToken cancellationToken) { IAsyncQueryProvider provider = this.dbContext.GetService <IAsyncQueryProvider>(); var queryResult = new List <T>(); using (var enumerator = provider.ExecuteAsync <T>(this.linqExpression).GetEnumerator()) { while (await enumerator.MoveNext(cancellationToken)) { queryResult.Add(enumerator.Current); } } return(queryResult); }
private async static Task <TResult> Execute <TSource, TResult>(IQueryable <TSource> source, string methodName) { if (source == null) { throw new ArgumentNullException(nameof(source)); } IAsyncQueryProvider provider = source.Provider as IAsyncQueryProvider; if (provider == null) { throw new NotSupportedException(); } MethodInfo method = typeof(AsyncQueryExtensions).GetMethod(methodName) .MakeGenericMethod(typeof(TSource)); return(await provider.ExecuteAsync <TResult>( Expression.Call(null, method, source.Expression))); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IAsyncEnumerator <TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default) => _queryProvider.ExecuteAsync <IAsyncEnumerable <TResult> >(Expression).GetAsyncEnumerator(cancellationToken);
public virtual IAsyncEnumerator <TEntity> GetAsyncEnumerator(CancellationToken token = default) => QueryProvider.ExecuteAsync <IAsyncEnumerable <TEntity> >(Expression).GetAsyncEnumerator(token);
public IAsyncEnumerable <TResult> ExecuteAsync <TResult>(Expression expression) { return(AsyncUnderlyingProvider.ExecuteAsync <TResult>(Intercept(expression))); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> IAsyncEnumerator <TResult> IAsyncEnumerable <TResult> .GetEnumerator() => _queryProvider.ExecuteAsync <IAsyncEnumerable <TResult> >(Expression).GetEnumerator();
/// <inheritdoc /> public Task <TResult> ExecuteAsync <TResult>(Expression expression, CancellationToken token) { // execute query with rewritten expression return(provider.ExecuteAsync <TResult>(rewriter.Visit(expression), token)); }
public Task <CouchList <TResult> > ToCouchListAsync(CancellationToken cancellationToken = default) => _queryProvider.ExecuteAsync <Task <CouchList <TResult> > >(_expression, cancellationToken);
IAsyncEnumerator <TEntity> IAsyncEnumerable <TEntity> .GetEnumerator() => QueryProvider.ExecuteAsync <TEntity>(Expression).GetEnumerator();