public void Execute(ExecutionContext context, Action <IExecutionContext> executor) { Argument.NotNull(executor, nameof(executor)); context.OpenConnection(); executor(context); context.MarkComplete(); }
public ExecutionContext CreateExecutionContext() { var compiler = _compilerBuilder.GetCompiler(); var context = new ExecutionContext(_connectionFactory, Provider, _core.CommandStringifier, compiler, _mapCache); _defaultBuilder?.Invoke(context); return(context); }
public async Task ExecuteAsync(ExecutionContext context, Func <IExecutionContext, Task> executor, CancellationToken cancellationToken = new CancellationToken()) { Argument.NotNull(executor, nameof(executor)); await context.OpenConnectionAsync(cancellationToken).ConfigureAwait(false); await executor(context).ConfigureAwait(false); context.MarkComplete(); }
public T Execute <T>(ExecutionContext context, Func <IExecutionContext, T> executor) { Argument.NotNull(executor, nameof(executor)); context.OpenConnection(); var result = executor(context); context.MarkComplete(); return(result); }
public void Execute(ExecutionContext context, IReadOnlyList <Action <IExecutionContext, int> > executors) { Argument.NotNull(executors, nameof(executors)); context.OpenConnection(); for (var i = 0; i < executors.Count; i++) { executors[i](context, i); } context.MarkComplete(); }