private async Task <T> ExecuteWriteOperationAsync <T>(IClientSessionHandle session, IWriteOperation <T> operation, CancellationToken cancellationToken) { using (var binding = new WritableServerBinding(_cluster, session.ToCoreSession())) { return(await _operationExecutor.ExecuteWriteOperationAsync(binding, operation, cancellationToken).ConfigureAwait(false)); } }
private T ExecuteWriteOperation <T>(IClientSessionHandle session, IWriteOperation <T> operation, CancellationToken cancellationToken) { using (var binding = new WritableServerBinding(_cluster, session.ToCoreSession())) { return(_operationExecutor.ExecuteWriteOperation(binding, operation, cancellationToken)); } }
private async Task <T> ExecuteReadOperationAsync <T>(IClientSessionHandle session, IReadOperation <T> operation, ReadPreference readPreference, CancellationToken cancellationToken) { using (var binding = new ReadPreferenceBinding(_cluster, readPreference, session.ToCoreSession())) { return(await _operationExecutor.ExecuteReadOperationAsync(binding, operation, cancellationToken).ConfigureAwait(false)); } }
private T ExecuteReadOperation <T>(IClientSessionHandle session, IReadOperation <T> operation, ReadPreference readPreference, CancellationToken cancellationToken) { using (var binding = new ReadPreferenceBinding(_cluster, readPreference, session.ToCoreSession())) { return(_operationExecutor.ExecuteReadOperation(binding, operation, cancellationToken)); } }
internal IWriteBindingHandle GetWriteBinding(IClientSessionHandle session) { var request = __threadStaticRequest; if (request != null) { return(ToWriteBinding(request.Binding).Fork()); } return(new ReadWriteBindingHandle(new WritableServerBinding(_cluster, session.ToCoreSession()))); }
// internal methods internal IReadBindingHandle GetReadBinding(ReadPreference readPreference, IClientSessionHandle session) { var request = __threadStaticRequest; if (request != null) { return(request.Binding.Fork()); } if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary) { return(new ReadWriteBindingHandle(new WritableServerBinding(_cluster, session.ToCoreSession()))); } else { return(new ReadBindingHandle(new ReadPreferenceBinding(_cluster, readPreference, session.ToCoreSession()))); } }
private TResult ExecuteReadOperation <TResult>(IClientSessionHandle session, IReadOperation <TResult> operation, CancellationToken cancellationToken = default(CancellationToken)) { using (var binding = new ReadPreferenceBinding(_cluster, _settings.ReadPreference, session.ToCoreSession())) { return(_operationExecutor.ExecuteReadOperation(binding, operation, cancellationToken)); } }