public SqliteConnectionFactoryWithRetry(SqliteTransientRetryPolicy retryPolicy, IConnectionStringFactory connectionStringFactory)
        {
            if (retryPolicy == null)
            {
                throw new ArgumentNullException(nameof(retryPolicy));
            }

            _proxy = RetryProxy.Create <IConnectionFactory>(
                connectionStringFactory == null ? new SqliteConnectionFactory() : new SqliteConnectionFactory(connectionStringFactory),
                retryPolicy);
        }
        public SqliteTransactionFactoryWithRetry(SqliteTransientRetryPolicy retryPolicy)
        {
            if (retryPolicy == null)
            {
                throw new ArgumentNullException(nameof(retryPolicy));
            }

            _proxy = RetryProxy.Create <ITransactionFactory>(
                new TransactionFactory(),
                retryPolicy);
        }
Esempio n. 3
0
        public SqliteDataComponentFactory(SqliteTransientRetryPolicy retryPolicy, IConnectionStringFactory connectionStringFactory) : base()
        {
            _connectionFactory =
                connectionStringFactory == null ?
                new SqliteConnectionFactoryWithRetry(retryPolicy) :
                new SqliteConnectionFactoryWithRetry(retryPolicy, connectionStringFactory);

            _transactionFactory = new SqliteTransactionFactoryWithRetry(retryPolicy);
            _dataAdapterFactory = new SqliteDataAdapterFactory();
            _parameterFactory   = new SqliteParameterFactory();
        }
        public SqliteConnectionFactoryWithRetry(SqliteTransientRetryPolicy retryPolicy, string connectionString) : base()
        {
            if (retryPolicy == null)
            {
                throw new ArgumentNullException(nameof(retryPolicy));
            }

            _proxy = RetryProxy.Create <IConnectionFactory>(
                string.IsNullOrEmpty(connectionString) ? new SqliteConnectionFactory() : new SqliteConnectionFactory(connectionString),
                retryPolicy);
        }
Esempio n. 5
0
        public SqliteDataComponentFactory(SqliteTransientRetryPolicy retryPolicy, string connectionString) : base()
        {
            _connectionFactory =
                string.IsNullOrEmpty(connectionString) ?
                new SqliteConnectionFactoryWithRetry(retryPolicy) :
                new SqliteConnectionFactoryWithRetry(retryPolicy, connectionString);

            _transactionFactory = new SqliteTransactionFactoryWithRetry(retryPolicy);
            _dataAdapterFactory = new SqliteDataAdapterFactory();
            _parameterFactory   = new SqliteParameterFactory();
        }
        public void BeginTransaction_WithRetry()
        {
            var retryPolicy = new SqliteTransientRetryPolicy(10, TimeSpan.FromSeconds(60));

            ITransactionFactory transactionFactory = new SqliteTransactionFactoryWithRetry(retryPolicy);
            IConnectionFactory  connectionFactory  = new SqliteConnectionFactoryWithRetry(retryPolicy);

            using (var connection = connectionFactory.Open(_connectionString))
                using (var transaction = transactionFactory.BeginTransaction(connection))
                {
                    Assert.IsNotNull(transaction);
                    Assert.AreEqual(connection, transaction.Connection);
                    Assert.AreEqual(IsolationLevel.Serializable, transaction.IsolationLevel);
                    transaction.Rollback();
                }
        }
        public SqliteExpressionReaderWithRetry(DbConnection dbConnection, SqliteTransientRetryPolicy retryPolicy)
        {
            var instance = new ExpressionReader(dbConnection, new SqliteParameterFactory(), new SqliteDataAdapterFactory());

            _proxy = RetryProxy.Create <IExpressionReader>(instance, retryPolicy);
        }
 public SqliteConnectionFactoryWithRetry(SqliteTransientRetryPolicy retryPolicy) : this(retryPolicy, string.Empty)
 {
 }
Esempio n. 9
0
 public SqliteDataComponentFactory(SqliteTransientRetryPolicy retryPolicy) : this(retryPolicy, string.Empty)
 {
 }
        public SqliteCommandWithRetry(DbConnection dbConnection, SqliteTransientRetryPolicy retryPolicy)
        {
            var instance = new Command(dbConnection, new SqliteParameterFactory());

            _proxy = RetryProxy.Create <ICommand>(instance, retryPolicy);
        }