Example #1
0
        /// <summary>
        /// Opens the session with the specified credentials.
        /// </summary>
        /// <param name="credentialsForSession">The credentials for session.</param>
        public IDocumentSession OpenSession(ICredentials credentialsForSession)
        {
            var session = new DocumentSession(this, queryListeners, storeListeners, deleteListeners, DatabaseCommands.With(credentialsForSession)
#if !NET_3_5
                                              , AsyncDatabaseCommands.With(credentialsForSession)
#endif
                                              );

            AfterSessionCreated(session);
            return(session);
        }
Example #2
0
        /// <summary>
        /// Opens the session with the specified credentials.
        /// </summary>
        /// <param name="credentialsForSession">The credentials for session.</param>
        public IDocumentSession OpenSession(ICredentials credentialsForSession)
        {
            EnsureNotClosed();

            var sessionId = Guid.NewGuid();

            currentSessionId = sessionId;
            try
            {
                var session = new DocumentSession(this, listeners, sessionId, DatabaseCommands.With(credentialsForSession)
#if !NET_3_5
                                                  , AsyncDatabaseCommands.With(credentialsForSession)
#endif
                                                  );
                AfterSessionCreated(session);
                return(session);
            }
            finally
            {
                currentSessionId = null;
            }
        }