private TResult ExecuteWriteOperation <TResult>(IWriteOperation <TResult> operation)
 {
     using (var binding = _server.GetWriteBinding())
     {
         return(operation.Execute(binding));
     }
 }
예제 #2
0
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadWriteBinding())
     {
         return(operation.Execute(binding, CancellationToken.None));
     }
 }
예제 #3
0
 private TResult ExecuteWriteOperation <TResult>(IWriteOperation <TResult> operation)
 {
     using (var binding = GetWriteBinding())
     {
         return(operation.Execute(binding, CancellationToken.None));
     }
 }
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation)
 {
     using (var binding = CreateReadWriteBinding())
         using (var bindingHandle = new ReadWriteBindingHandle(binding))
         {
             return(operation.Execute(bindingHandle, CancellationToken.None));
         }
 }
 protected void VerifySessionIdWasSentWhenSupported <TResult>(IWriteOperation <TResult> operation, string commandName, bool async)
 {
     VerifySessionIdWasSentWhenSupported(
         (binding, cancellationToken) => operation.ExecuteAsync(binding, cancellationToken),
         (binding, cancellationToken) => operation.Execute(binding, cancellationToken),
         commandName,
         async);
 }
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation)
 {
     using (var binding = CoreTestConfiguration.GetReadWriteBinding(_session.Fork()))
         using (var bindingHandle = new ReadWriteBindingHandle(binding))
         {
             return(operation.Execute(bindingHandle, CancellationToken.None));
         }
 }
예제 #7
0
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation, bool useImplicitSession = false)
 {
     using (var binding = CreateReadWriteBinding(useImplicitSession))
         using (var bindingHandle = new ReadWriteBindingHandle(binding))
         {
             return(operation.Execute(bindingHandle, CancellationToken.None));
         }
 }
예제 #8
0
 protected TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation, IReadWriteBinding binding, bool async)
 {
     if (async)
     {
         return(operation.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult());
     }
     else
     {
         return(operation.Execute(binding, CancellationToken.None));
     }
 }
예제 #9
0
 /// <summary>
 /// Executes a write operation using a channel source.
 /// </summary>
 /// <typeparam name="TResult">The type of the result.</typeparam>
 /// <param name="operation">The write operation.</param>
 /// <param name="channelSource">The channel source.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>The result of the operation.</returns>
 public static TResult Execute <TResult>(
     this IWriteOperation <TResult> operation,
     IChannelSourceHandle channelSource,
     CancellationToken cancellationToken)
 {
     Ensure.IsNotNull(operation, nameof(operation));
     using (var writeBinding = new ChannelSourceReadWriteBinding(channelSource.Fork(), ReadPreference.Primary))
     {
         return(operation.Execute(writeBinding, cancellationToken));
     }
 }
 protected void VerifySessionIdWasNotSentIfUnacknowledgedWrite <TResult>(
     IWriteOperation <TResult> operation,
     string commandName,
     bool async,
     bool useImplicitSession)
 {
     VerifySessionIdSending(
         (binding, cancellationToken) => operation.ExecuteAsync(binding, cancellationToken),
         (binding, cancellationToken) => operation.Execute(binding, cancellationToken),
         AssertSessionIdWasNotSentIfUnacknowledgedWrite,
         commandName,
         async,
         useImplicitSession);
 }
예제 #11
0
 private TResult ExecuteOperation <TResult>(IWriteOperation <TResult> operation, bool async)
 {
     using (var binding = CoreTestConfiguration.GetReadWriteBinding())
     {
         if (async)
         {
             return(operation.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult());
         }
         else
         {
             return(operation.Execute(binding, CancellationToken.None));
         }
     }
 }
예제 #12
0
 public TResult ExecuteWriteOperation <TResult>(IWriteBinding binding, IWriteOperation <TResult> operation, CancellationToken cancellationToken)
 {
     return(operation.Execute(binding, cancellationToken));
 }