public async Task <QueryExecutionResult <TResult> > ExecuteAsync <TSource, TResult>( IAsyncQuery <TSource, TResult> query, IQueryContext context ) { var source = _serviceProvider.GetService(typeof(TSource)); if (source is not null) { return(await query.ExecuteAsync((TSource)source, context)); } return(default);
public virtual Task <TResult> QueryAsync <TContext, TResult>(IAsyncQuery <TContext, TResult> query, TContext context) { if (query == null) { throw new ArgumentNullException(nameof(query)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } return(Decorator.Decorate(query, () => query.ExecuteAsync(context))); }
public Task <T> QueryAsync <T>(IAsyncQuery <T> query, CancellationToken cancellationToken = default) => Retry.DoAsync(() => query.ExecuteAsync(_connection, _transaction, cancellationToken), _retryOptions);