public async Task <TResult> ProcessAsync <TResult>(IQueryEntity <TResult> query) { this.logger.LogDebug($"Async Processing query {query}"); var handlerType = typeof(IAsyncQueryHandler <,>).MakeGenericType(query.GetType(), typeof(TResult)); dynamic handler = this.serviceProvider.GetService(handlerType); var queryResult = await handler?.ExecuteAsync((dynamic)query).ConfigureAwait(false); return(queryResult); }
public TResult Process <TResult>(IQueryEntity <TResult> query) { this.logger.LogDebug($"Processing query {query}"); var handlerType = typeof(IQueryHandler <,>).MakeGenericType(query.GetType(), typeof(TResult)); dynamic handler = this.serviceProvider.GetService(handlerType); var queryResult = handler?.Execute((dynamic)query); return(queryResult); }