示例#1
0
        private IReadBinding CreateReadBinding(IClientSessionHandle session, ReadPreference readPreference)
        {
            if (session.IsInTransaction && readPreference.ReadPreferenceMode != ReadPreferenceMode.Primary)
            {
                throw new InvalidOperationException("Read preference in a transaction must be primary.");
            }

            return(ChannelPinningHelper.CreateReadBinding(_cluster, session.WrappedCoreSession.Fork(), readPreference));
        }
示例#2
0
        private DisposableBindingBundle <IReadBindingHandle, RetryableReadContext> CreateReadBindingsAndRetryableReadContext(ICluster cluster, ICoreSessionHandle sessionHandle, bool async)
        {
            var readPreference = ReadPreference.Primary;

            var effectiveReadBindings = ChannelPinningHelper.CreateReadBinding(cluster, sessionHandle, readPreference);
            var retryableReadContext  = CreateRetryableReadContext(effectiveReadBindings, async);

            return(new DisposableBindingBundle <IReadBindingHandle, RetryableReadContext>(effectiveReadBindings, retryableReadContext));
        }