Ejemplo n.º 1
0
        private IClientSessionHandle StartImplicitSession(bool areSessionsSupported)
        {
            var options = new ClientSessionOptions();

            ICoreSessionHandle coreSession;

#pragma warning disable 618
            var areMultipleUsersAuthenticated = _settings.Credentials.Count() > 1;
#pragma warning restore
            if (areSessionsSupported && !areMultipleUsersAuthenticated)
            {
                coreSession = _cluster.StartSession(options.ToCore(isImplicit: true));
            }
            else
            {
                coreSession = NoCoreSession.NewHandle();
            }

            return(new ClientSessionHandle(this, options, coreSession));
        }
Ejemplo n.º 2
0
        private IClientSessionHandle StartImplicitSession(bool areSessionsSupported)
        {
            var options = new ClientSessionOptions();

            IServerSession serverSession;

#pragma warning disable 618
            var areMultipleUsersAuthenticated = _settings.Credentials.Count() > 1;
#pragma warning restore
            if (areSessionsSupported && !areMultipleUsersAuthenticated)
            {
                serverSession = AcquireServerSession();
            }
            else
            {
                serverSession = NoServerSession.Instance;
            }

            var session = new ClientSession(this, options, serverSession, isImplicit: true);
            return(new ClientSessionHandle(session));
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public sealed override async Task <IClientSessionHandle> StartSessionAsync(ClientSessionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var areSessionsSupported = await AreSessionsSupportedAsync(cancellationToken).ConfigureAwait(false);

            return(StartSession(options, areSessionsSupported));
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public sealed override IClientSessionHandle StartSession(ClientSessionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var areSessionsSupported = AreSessionsSupported(cancellationToken);

            return(StartSession(options, areSessionsSupported));
        }
Ejemplo n.º 5
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientSessionHandle" /> class.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="options">The options.</param>
 /// <param name="coreSession">The wrapped session.</param>
 public ClientSessionHandle(IMongoClient client, ClientSessionOptions options, ICoreSessionHandle coreSession)
     : this(client, options, coreSession, SystemClock.Instance)
 {
 }
Ejemplo n.º 6
0
 /// <inheritdoc />
 public virtual Task <IClientSessionHandle> StartSessionAsync(ClientSessionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }