internal StatelessSessionImpl(SessionFactoryImpl factory, ISessionCreationOptions options) : base(factory, options) { // This context is disposed only on session own disposal. This greatly reduces the number of context switches // for most usual session usages. It may cause an irrelevant session id to be set back on disposal, but since all // session entry points are supposed to set it, it should not have any consequences. _context = SessionIdLoggingContext.CreateOrNull(SessionId); try { temporaryPersistenceContext = new StatefulPersistenceContext(this); if (log.IsDebugEnabled()) { log.Debug("[session-id={0}] opened session for session factory: [{1}/{2}]", SessionId, factory.Name, factory.Uuid); } CheckAndUpdateSessionStatus(); } catch { _context?.Dispose(); throw; } }
internal StatelessSessionImpl(IDbConnection connection, SessionFactoryImpl factory) : base(factory) { using (new SessionIdLoggingContext(SessionId)) { temporaryPersistenceContext = new StatefulPersistenceContext(this); connectionManager = new ConnectionManager(this, connection, ConnectionReleaseMode.AfterTransaction, new EmptyInterceptor()); CheckAndUpdateSessionStatus(); } }
internal StatelessSessionImpl(SessionFactoryImpl factory, ISessionCreationOptions options) : base(factory, options) { using (BeginContext()) { temporaryPersistenceContext = new StatefulPersistenceContext(this); if (log.IsDebugEnabled()) { log.Debug("[session-id={0}] opened session for session factory: [{1}/{2}]", SessionId, factory.Name, factory.Uuid); } CheckAndUpdateSessionStatus(); } }
internal StatelessSessionImpl(DbConnection connection, SessionFactoryImpl factory) : base(factory) { using (new SessionIdLoggingContext(SessionId)) { temporaryPersistenceContext = new StatefulPersistenceContext(this); connectionManager = new ConnectionManager(this, connection, ConnectionReleaseMode.AfterTransaction, new EmptyInterceptor()); if (log.IsDebugEnabled) { log.DebugFormat("[session-id={0}] opened session for session factory: [{1}/{2}]", SessionId, factory.Name, factory.Uuid); } CheckAndUpdateSessionStatus(); } }
internal StatelessSessionImpl(SessionFactoryImpl factory, ISessionCreationOptions options) : base(factory, options) { using (BeginContext()) { temporaryPersistenceContext = new StatefulPersistenceContext(this); connectionManager = new ConnectionManager(this, options.UserSuppliedConnection, ConnectionReleaseMode.AfterTransaction, EmptyInterceptor.Instance, options.ShouldAutoJoinTransaction); if (log.IsDebugEnabled()) { log.Debug("[session-id={0}] opened session for session factory: [{1}/{2}]", SessionId, factory.Name, factory.Uuid); } CheckAndUpdateSessionStatus(); } }