Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerStorage"/> class with
        /// explicit instance of the <see cref="SqlConnection"/> class that will be used
        /// to query the data.
        /// </summary>
        /// <param name="existingConnection">Existing connection</param>
        public SQLiteStorage([NotNull] SqliteConnection existingConnection)
        {
            _existingConnection = existingConnection ?? throw new ArgumentNullException(nameof(existingConnection));
            _options            = new SQLiteStorageOptions();

            InitializeQueueProviders();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes SqlServerStorage from the provided SQLiteStorageOptions and either the provided connection
        /// string or the connection string with provided name pulled from the application config file.       
        /// </summary>
        /// <param name="nameOrConnectionString">Either a SQL Server connection string or the name of 
        /// a SQL Server connection string located in the connectionStrings node in the application config</param>
        /// <param name="options"></param>
        /// <exception cref="ArgumentNullException"><paramref name="nameOrConnectionString"/> argument is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="options"/> argument is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="nameOrConnectionString"/> argument is neither 
        /// a valid SQL Server connection string nor the name of a connection string in the application
        /// config file.</exception>
        public SQLiteStorage(string nameOrConnectionString, SQLiteStorageOptions options)
        {
            if (string.IsNullOrEmpty(nameOrConnectionString)) throw new ArgumentNullException("nameOrConnectionString");
            if (options == null) throw new ArgumentNullException("options");

            _options = options;

            if (IsConnectionString(nameOrConnectionString))
            {
                _connectionString = nameOrConnectionString;
            }
            else if (IsConnectionStringInConfiguration(nameOrConnectionString))
            {
                _connectionString = ConfigurationManager.ConnectionStrings[nameOrConnectionString].ConnectionString;
            }
            else
            {
                throw new ArgumentException(
                    string.Format("Could not find connection string with name '{0}' in application config file",
                                  nameOrConnectionString));
            }

            if (options.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    SQLiteObjectsInstaller.Install(connection); 
                }
            }

            InitializeQueueProviders();
        }
        public SQLiteJobQueue(IDbConnection connection, SQLiteStorageOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");
            if (connection == null) throw new ArgumentNullException("connection");

            _options = options;
            _connection = connection;
        }
        public SQLiteJobQueue([NotNull] SQLiteStorage storage, SQLiteStorageOptions options)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (options == null) throw new ArgumentNullException("options");

            _storage = storage;
            _options = options;
        }
        public SQLiteJobQueueProvider(SQLiteStorageOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _options = options;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerStorage"/> class with
        /// explicit instance of the <see cref="SqlConnection"/> class that will be used
        /// to query the data.
        /// </summary>
        /// <param name="existingConnection">Existing connection</param>
        public SQLiteStorage([NotNull] SQLiteConnection existingConnection)
        {
            if (existingConnection == null)
            {
                throw new ArgumentNullException("existingConnection");
            }

            _existingConnection = existingConnection;
            _options            = new SQLiteStorageOptions();

            InitializeQueueProviders();
        }
Beispiel #7
0
        public SQLiteJobQueue([NotNull] SQLiteStorage storage, SQLiteStorageOptions options)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _storage = storage;
            _options = options;
        }
        public SQLiteJobQueueProvider([NotNull] SQLiteStorage storage, [NotNull] SQLiteStorageOptions options)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _jobQueue      = new SQLiteJobQueue(storage, options);
            _monitoringApi = new SQLiteJobQueueMonitoringApi(storage);
        }
Beispiel #9
0
        public SQLiteJobQueue(IDbConnection connection, SQLiteStorageOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            _options    = options;
            _connection = connection;
        }
        public SQLiteStorage([NotNull] DbConnection existingConnection, [NotNull] SQLiteStorageOptions options)
        {
            if (existingConnection == null)
            {
                throw new ArgumentNullException(nameof(existingConnection));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _existingConnection = existingConnection;
            _options            = options;

            Initialize();
        }
        /// <summary>
        /// Initializes SqlServerStorage from the provided SQLiteStorageOptions and either the provided connection
        /// string or the connection string with provided name pulled from the application config file.
        /// </summary>
        /// <param name="nameOrConnectionString">Either a SQL Server connection string or the name of
        /// a SQL Server connection string located in the connectionStrings node in the application config</param>
        /// <param name="options"></param>
        /// <exception cref="ArgumentNullException"><paramref name="nameOrConnectionString"/> argument is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="options"/> argument is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="nameOrConnectionString"/> argument is neither
        /// a valid SQL Server connection string nor the name of a connection string in the application
        /// config file.</exception>
        public SQLiteStorage(string nameOrConnectionString, SQLiteStorageOptions options)
        {
            if (string.IsNullOrEmpty(nameOrConnectionString))
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _options = options;

            if (IsConnectionString(nameOrConnectionString))
            {
                _connectionString = nameOrConnectionString;
            }
            else if (IsConnectionStringInConfiguration(nameOrConnectionString))
            {
                _connectionString = ConfigurationManager.ConnectionStrings[nameOrConnectionString].ConnectionString;
            }
            else
            {
                throw new ArgumentException(
                          string.Format("Could not find connection string with name '{0}' in application config file",
                                        nameOrConnectionString));
            }

            if (!_dbMonitorCache.ContainsKey(_connectionString))
            {
                _dbMonitorCache.Add(_connectionString, new ReaderWriterLock());
            }

            if (options.PrepareSchemaIfNecessary)
            {
                UseConnection(connection =>
                {
                    SQLiteObjectsInstaller.Install(connection, options.SchemaName);
                });
            }

            InitializeQueueProviders();
        }
        /// <summary>
        /// Initializes SqlServerStorage from the provided SQLiteStorageOptions and either the provided connection
        /// string or the connection string with provided name pulled from the application config file.
        /// </summary>
        /// <param name="nameOrConnectionString">Either a SQL Server connection string or the name of
        /// a SQL Server connection string located in the connectionStrings node in the application config</param>
        /// <param name="options"></param>
        /// <exception cref="ArgumentNullException"><paramref name="nameOrConnectionString"/> argument is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="options"/> argument is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="nameOrConnectionString"/> argument is neither
        /// a valid SQL Server connection string nor the name of a connection string in the application
        /// config file.</exception>
        public SQLiteStorage(string nameOrConnectionString, SQLiteStorageOptions options)
        {
            if (string.IsNullOrEmpty(nameOrConnectionString))
            {
                throw new ArgumentNullException(nameof(nameOrConnectionString));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _connectionString = GetConnectionString(nameOrConnectionString);
            _options          = options;

            if (!_dbMonitorCache.ContainsKey(_connectionString))
            {
                _dbMonitorCache.Add(_connectionString, new ReaderWriterLockSlim());
            }

            Initialize();
        }
Beispiel #13
0
        public static IGlobalConfiguration <SQLiteStorage> UseSQLiteStorage(
            [NotNull] this IGlobalConfiguration configuration,
            [NotNull] string nameOrConnectionString,
            [NotNull] SQLiteStorageOptions options)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (nameOrConnectionString == null)
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            var storage = new SQLiteStorage(nameOrConnectionString, options);

            return(configuration.UseStorage(storage));
        }
        /// <summary>
        /// Initializes SqlServerStorage from the provided SQLiteStorageOptions and either the provided connection
        /// string or the connection string with provided name pulled from the application config file.
        /// </summary>
        /// <param name="nameOrConnectionString">Either a SQL Server connection string or the name of
        /// a SQL Server connection string located in the connectionStrings node in the application config</param>
        /// <param name="options"></param>
        /// <exception cref="ArgumentNullException"><paramref name="nameOrConnectionString"/> argument is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="options"/> argument is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="nameOrConnectionString"/> argument is neither
        /// a valid SQL Server connection string nor the name of a connection string in the application
        /// config file.</exception>
        public SQLiteStorage(string nameOrConnectionString, SQLiteStorageOptions options)
        {
            if (string.IsNullOrEmpty(nameOrConnectionString))
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _options = options;

            if (IsConnectionString(nameOrConnectionString))
            {
                _connectionString = nameOrConnectionString;
            }
            else if (IsConnectionStringInConfiguration(nameOrConnectionString))
            {
                _connectionString = ConfigurationManager.ConnectionStrings[nameOrConnectionString].ConnectionString;
            }
            else
            {
                throw new ArgumentException(
                          string.Format("Could not find connection string with name '{0}' in application config file",
                                        nameOrConnectionString));
            }

            if (options.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    SQLiteObjectsInstaller.Install(connection);
                }
            }

            InitializeQueueProviders();
        }
Beispiel #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerStorage"/> class with
        /// explicit instance of the <see cref="SqlConnection"/> class that will be used
        /// to query the data.
        /// </summary>
        /// <param name="existingConnection">Existing connection</param>
        public SQLiteStorage([NotNull] IDbConnection existingConnection)
        {
            if (existingConnection == null) throw new ArgumentNullException("existingConnection");

            _existingConnection = existingConnection;
            _options = new SQLiteStorageOptions();

            InitializeQueueProviders();
        }
        public SQLiteJobQueueProvider(SQLiteStorageOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");

            _options = options;
        }