public SessionScope( bool readOnly, IsolationLevel?isolationLevel, ISessionConnectionFactory factory, ScopeOption option = ScopeOption.Required, ISessionExceptionHandler exceptionHandler = null) : base(new SessionConnectionCollection(readOnly, isolationLevel, factory, exceptionHandler), option) { _completed = false; _readOnly = readOnly; _exceptionHandler = exceptionHandler; if (isolationLevel != null && option == ScopeOption.Required) { throw new ArgumentException( "Can't join an ambient session if an explicit database transaction is required"); } if (Nested && option == ScopeOption.Required) { var parentScope = ParentScope; if (parentScope._readOnly && !_readOnly) { throw new InvalidOperationException( "Cannot nest a read/write session scope within a read-only scope"); } } }
public SessionConnectionCollection(bool readOnly, IsolationLevel?isolationLevel, ISessionConnectionFactory factory, ISessionExceptionHandler exceptionHandler) { _readOnly = readOnly; _isolationLevel = isolationLevel; _factory = factory; _exceptionHandler = exceptionHandler; InitializedConnections = new Dictionary <Type, ISessionConnection>(); _transactions = new Dictionary <ISessionConnection, IDbTransaction>(); }
public SessionScopeFactory(ISessionConnectionFactory factory, ISessionExceptionHandler exceptionHandler = null) { _factory = factory; _exceptionHandler = exceptionHandler; }