public async Task <T> ExecuteAsync <T>(IQueryAsync <T> query) { using (var connection = await this.connectionFactory.GetOpenConnectionAsync()) { return(await query.ExecuteAsync(connection)); } }
/// <summary> /// Initializes a new instance of the <see cref="VolleyUserStore"/> class. /// </summary> /// <param name="userRepository"> The user repository. </param> /// <param name="getByIdQuery"> Get By Id object query</param> /// <param name="getByNameQuery"> Get By Name object query</param> /// <param name="getByEmailQuery"> Get By Email object query</param> /// <param name="getByLoginInfoQuery"> Get By Login information object query</param> public VolleyUserStore( IUserRepository userRepository, IQueryAsync <User, FindByIdCriteria> getByIdQuery, IQueryAsync <User, FindByNameCriteria> getByNameQuery, IQueryAsync <User, FindByEmailCriteria> getByEmailQuery, IQueryAsync <User, FindByLoginInfoCriteria> getByLoginInfoQuery) { _userRepository = userRepository; _getByIdQuery = getByIdQuery; _getByNameQuery = getByNameQuery; _getByEmailQuery = getByEmailQuery; _getByLoginInfoQuery = getByLoginInfoQuery; }
public async Task <TResult> DispatchAsync <TResult>(IQueryAsync <TResult> query) { using var scope = _provider.CreateScope(); var type = typeof(IQueryHandlerAsync <,>); var handlerType = type.MakeGenericType(query.GetType(), typeof(TResult)); var handler = scope.ServiceProvider.GetRequiredService(handlerType); var handle = handlerType.GetMethod("HandleAsync"); if (handle == null) { throw new InvalidOperationException( $"Method 'Handle' not found on type {handlerType.FullName}"); } var result = await(Task <TResult>) handle.Invoke(handler, new object[] { query }); return(result); }
public static Task <TSource> Get <TSource>(this IQueryAsync <TSource> _, object key) where TSource : class, new() => ExpressionQueryExtension.ExecFunction(
public async Task <TResult> ExecuteQueryAsync <TSearch, TResult>(IQueryAsync <TSearch, TResult> query, TSearch search) { logger.Log(query, search); return(await query.Execute(search)); }
public ClientStore(IQueryAsync <GetClientByClientIdQueryRequest, IdentityClient> getClientByClientId) { _getClientByClientId = getClientByClientId; }
public static async Task <IQueryResult <TResult> > ExecuteAsync <T, TResult>(this IQueryAsync <T> query, IRepositoryAsync repository, Func <T, TResult> translate) where TResult : class { var result = await query.ExecuteAsync(repository).ConfigureAwait(false); return(new QueryResult <TResult>(result.Items.Select(translate), result.TotalCount)); }
/// <summary> /// Executes a prebuilt <see cref="IQueryAsync{T}" /> and returns an <see cref="IEnumerable{T}" /> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="queryAsync">The query asynchronous.</param> /// <returns>Task<IEnumerable<T>>.</returns> public virtual async Task <IEnumerable <T> > FindAsync <T>(IQueryAsync <T> queryAsync) { return(await queryAsync.ExecuteAsync(Executor)); }
public ResourceStore(IQueryAsync <GetIdentityApiByApiScopesQueryRequest, IEnumerable <IdentityApi> > getIdentityApiByApiScopesQuery) { _getIdentityApiByApiScopesQuery = getIdentityApiByApiScopesQuery; }
public static async Task <TResult> ExecuteAsync <TResult>(this CloudTable table, IQueryAsync <CloudTable, TResult> query) { return(await query.ExecuteAsync(table)); }