Exemplo n.º 1
0
        public static async Task <TReturn> ExecAsync <TReturn>(this IExecutorAsync executorAsync, IQuery <TReturn> query)
        {
            var context = new ExecutionContext {
                Executable = query
            };

            return((TReturn)await executorAsync.ExecuteAsync(context));
        }
Exemplo n.º 2
0
        async Task <object> IExecutorAsync.ExecuteAsync(IExecutionContext context)
        {
            using (var session = _sessionFactory.OpenSession())
                using (var repository = new NhSqlRepository(session))
                {
                    var previous = _accessor();
                    try
                    {
                        repository.BeginTransaction();
                        _mutator(repository);
                        var result = await _inner.ExecuteAsync(context);

                        repository.Commit();
                        return(result);
                    }
                    finally
                    {
                        _mutator(previous);
                    }
                }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Resolves an instance of TExecutableVoidAsync using dedicated scope and executes it asynchronously.
 /// </summary>
 /// <typeparam name="TExecutableVoidAsync">The type of the executable to resolve.</typeparam>
 /// <returns>A Task representing the asynchronous execution result.</returns>
 public async Task ExecuteAsync <TExecutableVoidAsync>() where TExecutableVoidAsync : class, IExecutableVoidAsync
 => await _executorAsync.ExecuteAsync <TExecutableVoidAsync>();
 Task <object> IExecutorAsync.ExecuteAsync(IExecutionContext context)
 {
     ExecutableValidator.Validate(context.Executable);
     return(_inner.ExecuteAsync(context));
 }