Example #1
0
 private async Task <TResult> ExecuteEndTransactionOnPrimaryAsync <TResult>(IReadOperation <TResult> operation, CancellationToken cancellationToken)
 {
     using (var sessionHandle = new NonDisposingCoreSessionHandle(this))
         using (var binding = new WritableServerBinding(_cluster, sessionHandle))
         {
             return(await operation.ExecuteAsync(binding, cancellationToken).ConfigureAwait(false));
         }
 }
Example #2
0
 private TResult ExecuteEndTransactionOnPrimary <TResult>(IReadOperation <TResult> operation, CancellationToken cancellationToken)
 {
     using (var sessionHandle = new NonDisposingCoreSessionHandle(this))
         using (var binding = new WritableServerBinding(_cluster, sessionHandle))
         {
             return(operation.Execute(binding, cancellationToken));
         }
 }
        public void constructor_should_initialize_instance()
        {
            var wrapped = Mock.Of <ICoreSession>();

            var result = new NonDisposingCoreSessionHandle(wrapped);

            result._ownsWrapped().Should().BeFalse();
            result._wrapped().Should().BeSameAs(wrapped);
        }
 public static ICoreSession _wrapped(this NonDisposingCoreSessionHandle obj) => (ICoreSession)Reflector.GetFieldValue(obj, nameof(_wrapped));