public TransactionState(IConnectionFactory factory, CommandRunnerMode mode, IsolationLevel isolationLevel, int commandTimeout) { _mode = mode; _isolationLevel = isolationLevel; this._commandTimeout = commandTimeout; Connection = factory.Create(); }
public TransactionState(IConnectionFactory factory, CommandRunnerMode mode, IsolationLevel isolationLevel) { _mode = mode; _isolationLevel = isolationLevel; Connection = factory.Create(); Connection.Open(); BeginTransaction(); }
public TransactionState(IConnectionFactory factory, CommandRunnerMode mode, IsolationLevel isolationLevel) { _isolationLevel = isolationLevel; Connection = factory.Create(); Connection.Open(); if (mode == CommandRunnerMode.Transactional) { Transaction = Connection.BeginTransaction(isolationLevel); } }
public ManagedConnection(SessionOptions options, CommandRunnerMode mode) : this(options, mode, new NulloRetryPolicy()) { }
public IManagedConnection OpenConnection(CommandRunnerMode mode = CommandRunnerMode.AutoCommit, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, int?timeout = null) { return(_inner.OpenConnection(mode, isolationLevel, timeout)); }
/// <summary> /// Directly open a managed connection to the underlying Postgresql database /// </summary> /// <param name="mode"></param> /// <param name="isolationLevel"></param> /// <returns></returns> public IManagedConnection OpenConnection(CommandRunnerMode mode = CommandRunnerMode.AutoCommit, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted) { return(new ManagedConnection(Options.ConnectionFactory(), mode, isolationLevel)); }
public ManagedConnection(IConnectionFactory factory, CommandRunnerMode mode, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted) { _connection = new Lazy <TransactionState>(() => new TransactionState(factory, mode, isolationLevel)); }
/// <summary> /// Directly open a managed connection to the underlying Postgresql database /// </summary> /// <param name="mode"></param> /// <param name="isolationLevel"></param> /// <param name="timeout"></param> /// <returns></returns> public IManagedConnection OpenConnection(CommandRunnerMode mode = CommandRunnerMode.AutoCommit, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, int?timeout = null) { return(new ManagedConnection(_factory, mode, _options.RetryPolicy(), isolationLevel, timeout)); }
/// <summary> /// Directly open a managed connection to the underlying Postgresql database /// </summary> /// <param name="mode"></param> /// <param name="isolationLevel"></param> /// <returns></returns> public IManagedConnection OpenConnection(CommandRunnerMode mode = CommandRunnerMode.ReadOnly, IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted) { return new ManagedConnection(Options.ConnectionFactory(), mode, isolationLevel); }
public ManagedConnection(IConnectionFactory factory, CommandRunnerMode mode, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, int commandTimeout = 30) : this(factory, mode, new NulloRetryPolicy(), isolationLevel, commandTimeout) { }
internal async Task <IConnectionLifetime> InitializeAsync(DocumentStore store, CommandRunnerMode mode, CancellationToken token) { Mode = mode; Tenant ??= TenantId != null ? await store.Tenancy.GetTenantAsync(TenantId).ConfigureAwait(false) : store.Tenancy.Default; if (!store.Options.Advanced.DefaultTenantUsageEnabled && Tenant.TenantId == Marten.Storage.Tenancy.DefaultTenantId) { throw new DefaultTenantUsageDisabledException(); } if (!OwnsTransactionLifecycle && mode != CommandRunnerMode.ReadOnly) { Mode = CommandRunnerMode.External; } if (OwnsConnection && OwnsTransactionLifecycle) { var transaction = mode == CommandRunnerMode.ReadOnly ? new ReadOnlyMartenControlledConnectionTransaction(this) : new MartenControlledConnectionTransaction(this); await transaction.BeginTransactionAsync(token).ConfigureAwait(false); return(transaction); } if (Transaction != null) { return(new ExternalTransaction(this)); } if (DotNetTransaction != null) { return(new AmbientTransactionLifetime(this)); } throw new NotSupportedException("Invalid combination of SessionOptions"); }
/// <summary> /// Directly open a managed connection to the underlying Postgresql database /// </summary> /// <param name="mode"></param> /// <param name="isolationLevel"></param> /// <param name="timeout"></param> /// <returns></returns> public IManagedConnection OpenConnection(CommandRunnerMode mode = CommandRunnerMode.AutoCommit, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, int timeout = 30) { return(new ManagedConnection(_factory, mode, isolationLevel, timeout)); }