public async Task SendAsync(IServerOperation operation, CancellationToken token = default(CancellationToken))
 {
     using (_requestExecutor.ContextPool.AllocateOperationContext(out var context))
     {
         var command = operation.GetCommand(_requestExecutor.Conventions, context);
         await _requestExecutor.ExecuteAsync(command, context, token).ConfigureAwait(false);
     }
 }
        public async Task <Operation> SendAsync(IServerOperation <OperationIdResult> operation, CancellationToken token = default(CancellationToken))
        {
            using (_requestExecutor.ContextPool.AllocateOperationContext(out var context))
            {
                var command = operation.GetCommand(_requestExecutor.Conventions, context);

                await _requestExecutor.ExecuteAsync(command, context, token).ConfigureAwait(false);

                return(new ServerWideOperation(_requestExecutor, () => _store.Changes(), _requestExecutor.Conventions, command.Result.OperationId));
            }
        }
Example #3
0
        public async Task <TResult> SendAsync <TResult>(IServerOperation <TResult> operation, CancellationToken token = default(CancellationToken))
        {
            using (GetContext(out JsonOperationContext context))
            {
                var command = operation.GetCommand(_requestExecutor.Conventions, context);

                await _requestExecutor.ExecuteAsync(command, context, token).ConfigureAwait(false);

                return(command.Result);
            }
        }
Example #4
0
        public async Task <Operation> SendAsync(IServerOperation <OperationIdResult> operation, CancellationToken token = default)
        {
            using (_requestExecutor.ContextPool.AllocateOperationContext(out var context))
            {
                var command = operation.GetCommand(_requestExecutor.Conventions, context);

                await _requestExecutor.ExecuteAsync(command, context, sessionInfo : null, token : token).ConfigureAwait(false);

                return(new ServerWideOperation(_requestExecutor, _requestExecutor.Conventions, command.Result.OperationId, command.SelectedNodeTag ?? command.Result.OperationNodeTag));
            }
        }
Example #5
0
        public async Task <TResult> SendAsync <TResult>(IServerOperation <TResult> operation, CancellationToken token = default)
        {
            using (_requestExecutor.ContextPool.AllocateOperationContext(out var context))
            {
                var command = operation.GetCommand(_requestExecutor.Conventions, context);

                await _requestExecutor.ExecuteAsync(command, context, sessionInfo : null, token : token).ConfigureAwait(false);

                return(command.Result);
            }
        }
 public Operation Send(IServerOperation <OperationIdResult> operation)
 {
     return(AsyncHelpers.RunSync(() => SendAsync(operation)));
 }
 public TResult Send <TResult>(IServerOperation <TResult> operation)
 {
     return(AsyncHelpers.RunSync(() => SendAsync(operation)));
 }
 public void Send(IServerOperation operation)
 {
     AsyncHelpers.RunSync(() => SendAsync(operation));
 }