public SqlServerDataComponentFactory(RetryOptions retryOptions, string connectionString) : base() { _connectionFactory = String.IsNullOrEmpty(connectionString) ? new SqlServerConnectionFactoryWithRetry(retryOptions) : new SqlServerConnectionFactoryWithRetry(retryOptions, connectionString); _transactionFactory = new SqlServerTransactionFactoryWithRetry(retryOptions); _dataAdapterFactory = new SqlServerDataAdapterFactory(); _parameterFactory = new SqlServerParameterFactory(); }
public SqlServerDataComponentFactory(SqlServerTransientRetryPolicy retryPolicy, IConnectionStringFactory connectionStringFactory) : base() { _connectionFactory = connectionStringFactory == null ? new SqlServerConnectionFactoryWithRetry(retryPolicy) : new SqlServerConnectionFactoryWithRetry(retryPolicy, connectionStringFactory); _transactionFactory = new SqlServerTransactionFactoryWithRetry(retryPolicy); _dataAdapterFactory = new SqlServerDataAdapterFactory(); _parameterFactory = new SqlServerParameterFactory(); }
public SqlServerDataComponentFactory(SqlServerTransientRetryPolicy retryPolicy, string connectionString) : base() { _connectionFactory = string.IsNullOrEmpty(connectionString) ? new SqlServerConnectionFactoryWithRetry(retryPolicy) : new SqlServerConnectionFactoryWithRetry(retryPolicy, connectionString); _transactionFactory = new SqlServerTransactionFactoryWithRetry(retryPolicy); _dataAdapterFactory = new SqlServerDataAdapterFactory(); _parameterFactory = new SqlServerParameterFactory(); }
public void BeginTransaction_WithIsolationLevel_WithRetry() { var retryPolicy = new SqlServerTransientRetryPolicy(10, TimeSpan.FromSeconds(60)); ITransactionFactory transactionFactory = new SqlServerTransactionFactoryWithRetry(retryPolicy); IConnectionFactory connectionFactory = new SqlServerConnectionFactoryWithRetry(retryPolicy); using (var connection = connectionFactory.Open(AppState.ConnectionString)) using (var transaction = transactionFactory.BeginTransaction(connection, IsolationLevel.Snapshot)) { Assert.IsNotNull(transaction); Assert.AreEqual(connection, transaction.Connection); Assert.AreEqual(IsolationLevel.Snapshot, transaction.IsolationLevel); transaction.Rollback(); } }
public void BeginTransaction_WithRetry() { var retryOptions = new RetryOptions(10, TimeSpan.FromSeconds(60)); ITransactionFactory transactionFactory = new SqlServerTransactionFactoryWithRetry(retryOptions); IConnectionFactory connectionFactory = new SqlServerConnectionFactoryWithRetry(retryOptions); using (var connection = connectionFactory.Open(AppState.ConnectionString)) using (var transaction = transactionFactory.BeginTransaction(connection)) { Assert.IsNotNull(transaction); Assert.AreEqual(connection, transaction.Connection); Assert.AreEqual(IsolationLevel.ReadCommitted, transaction.IsolationLevel); transaction.Rollback(); } }