Example #1
0
        /// <summary>
        /// Initializes SqlServerStorage from the provided SqlServerStorageOptions 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 SqlServerStorage(string nameOrConnectionString, SqlServerStorageOptions options)
        {
            if (nameOrConnectionString == null) 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())
                {
                    SqlServerObjectsInstaller.Install(connection);
                }
            }

            var defaultQueueProvider = new SqlServerJobQueueProvider(options);
            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
 public PostgreSqlConnection(
     NpgsqlConnection connection,
     PersistentJobQueueProviderCollection queueProviders,
     PostgreSqlStorageOptions options)
     : this(connection, queueProviders, options, true)
 {
 }
 public SqlServerConnection(
     SqlConnection connection,
     IsolationLevel? isolationLevel,
     PersistentJobQueueProviderCollection queueProviders)
     : this(connection, isolationLevel, queueProviders, true)
 {
 }
 public FirebirdConnection(
     FbConnection connection,
     PersistentJobQueueProviderCollection queueProviders,
     FirebirdStorageOptions options)
     : this(connection, queueProviders, options, true)
 {
 }
 public MySqlMonitoringApi(
     string connectionString,
     PersistentJobQueueProviderCollection queueProviders)
     : base(connectionString)
 {
     _queueProviders = queueProviders;
 }
        public MySqlWriteOnlyTransaction(
            string connectionString,
            PersistentJobQueueProviderCollection queueProviders) : base(connectionString)
        {
            _queueProviders = queueProviders;
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");

        }
        public SqlServerWriteOnlyTransactionFacts()
        {
            var defaultProvider = new Mock<IPersistentJobQueueProvider>();
            defaultProvider.Setup(x => x.GetJobQueue(It.IsNotNull<IDbConnection>()))
                .Returns(new Mock<IPersistentJobQueue>().Object);

            _queueProviders = new PersistentJobQueueProviderCollection(defaultProvider.Object);
        }
		public MongoWriteOnlyTransactionFacts()
		{
			Mock<IPersistentJobQueueProvider> defaultProvider = new Mock<IPersistentJobQueueProvider>();
			defaultProvider.Setup(x => x.GetJobQueue(It.IsNotNull<HangfireDbContext>()))
				.Returns(new Mock<IPersistentJobQueue>().Object);

			_queueProviders = new PersistentJobQueueProviderCollection(defaultProvider.Object);
		}
        public MongoConnectionFacts()
        {
            _queue = new Mock<IPersistentJobQueue>();

            _provider = new Mock<IPersistentJobQueueProvider>();
            _provider.Setup(x => x.GetJobQueue(It.IsNotNull<HangfireDbContext>())).Returns(_queue.Object);

            _providers = new PersistentJobQueueProviderCollection(_provider.Object);
        }
 public MySqlStorageConnection(
     string connectionString,
     PersistentJobQueueProviderCollection queueProviders,
     bool ownsConnection)
     : base(connectionString)
 {
     queueProviders.Should().NotBeNull();
     _queueProviders = queueProviders;
 }
        public SqlServerWriteOnlyTransaction( 
            SqlConnection connection,
            PersistentJobQueueProviderCollection queueProviders)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");

            _connection = connection;
            _queueProviders = queueProviders;
        }
        public SqlServerConnectionFacts()
        {
            _queue = new Mock<IPersistentJobQueue>();

            var provider = new Mock<IPersistentJobQueueProvider>();
            provider.Setup(x => x.GetJobQueue(It.IsNotNull<IDbConnection>()))
                .Returns(_queue.Object);

            _providers = new PersistentJobQueueProviderCollection(provider.Object);
        }
        public MongoWriteOnlyTransaction(HangfireDbContext connection, PersistentJobQueueProviderCollection queueProviders)
        {
            if (connection == null)
                throw new ArgumentNullException("connection");

            if (queueProviders == null)
                throw new ArgumentNullException("queueProviders");

            _connection = connection;
            _queueProviders = queueProviders;
        }
        public SQLiteWriteOnlyTransaction(
            IDbConnection connection,
            IsolationLevel? isolationLevel,
            PersistentJobQueueProviderCollection queueProviders)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");

            _connection = connection;
            _isolationLevel = isolationLevel;
            _queueProviders = queueProviders;
        }
Example #15
0
        public SqlServerConnection(
            SqlConnection connection, 
            PersistentJobQueueProviderCollection queueProviders,
            IsolationLevel writeIsolationLevel)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");

            _connection = connection;
            _queueProviders = queueProviders;
            _writeIsolationLevel = writeIsolationLevel;
        }
        public PostgreSqlWriteOnlyTransactionFacts()
        {
            var defaultProvider = new Mock<IPersistentJobQueueProvider>();
            defaultProvider.Setup(x => x.GetJobQueue(It.IsNotNull<IDbConnection>()))
                .Returns(new Mock<IPersistentJobQueue>().Object);

            _queueProviders = new PersistentJobQueueProviderCollection(defaultProvider.Object);
            _options = new PostgreSqlStorageOptions()
            {
                SchemaName = GetSchemaName()
            };
        }
        public FirebirdWriteOnlyTransaction( 
            FbConnection connection,
            FirebirdStorageOptions options,
            PersistentJobQueueProviderCollection queueProviders)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");
            if (options == null) throw new ArgumentNullException("options");

            _connection = connection;
            _options = options;
            _queueProviders = queueProviders;
        }
        public PostgreSqlWriteOnlyTransaction(
            NpgsqlConnection connection,
            PostgreSqlStorageOptions options,
            PersistentJobQueueProviderCollection queueProviders)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");
            if (options == null) throw new ArgumentNullException("options");

            _connection = connection;
;
            _options = options;
            _queueProviders = queueProviders;
        }
		public PostgreSqlConnectionFacts()
		{
			_queue = new Mock<IPersistentJobQueue>();

			_provider = new Mock<IPersistentJobQueueProvider>();
			_provider.Setup(x => x.GetJobQueue(It.IsNotNull<IDbConnection>()))
				.Returns(_queue.Object);

			_providers = new PersistentJobQueueProviderCollection(_provider.Object);

			_options = new PostgreSqlStorageOptions()
			{
				SchemaName = GetSchemaName()
			};
		}
        public PostgreSqlConnection(
            NpgsqlConnection connection, 
            PersistentJobQueueProviderCollection queueProviders,
            PostgreSqlStorageOptions options,
            bool ownsConnection)
        {
            if (connection == null) throw new ArgumentNullException("connection");
            if (queueProviders == null) throw new ArgumentNullException("queueProviders");
            if (options == null) throw new ArgumentNullException("options");

            _connection = connection;
            _queueProviders = queueProviders;
            _options = options;
            OwnsConnection = ownsConnection;
        }
		public SQLiteConnection(
			IDbConnection connection,
			IsolationLevel? isolationLevel,
			PersistentJobQueueProviderCollection queueProviders,
			bool ownsConnection)
		{
			if (connection == null) throw new ArgumentNullException("connection");
			if (queueProviders == null) throw new ArgumentNullException("queueProviders");

			_connection = connection;
			_isolationLevel = isolationLevel;
			_queueProviders = queueProviders;

			OwnsConnection = ownsConnection;
		}
        public FirebirdConnectionFacts()
        {
            _queue = new Mock<IPersistentJobQueue>();

            var provider = new Mock<IPersistentJobQueueProvider>();
            provider.Setup(x => x.GetJobQueue(It.IsNotNull<IDbConnection>()))
                .Returns(_queue.Object);

            _providers = new PersistentJobQueueProviderCollection(provider.Object);

            _options = new FirebirdStorageOptions()
            {
                
            };
        }
        public MongoConnection(HangfireDbContext database, MongoStorageOptions options, PersistentJobQueueProviderCollection queueProviders)
        {
            if (database == null)
                throw new ArgumentNullException("database");

            if (queueProviders == null)
                throw new ArgumentNullException("queueProviders");

            if (options == null)
                throw new ArgumentNullException("options");

            _database = database;
            _options = options;
            _queueProviders = queueProviders;
        }
Example #24
0
        /// <summary>
        /// Constructs Job Storage by database connection string, name andoptions
        /// </summary>
        /// <param name="connectionString">MongoDB connection string</param>
        /// <param name="databaseName">Database name</param>
        /// <param name="options">Storage options</param>
        public MongoStorage(string connectionString, string databaseName, MongoStorageOptions options)
        {
            if (String.IsNullOrWhiteSpace(connectionString) == true)
                throw new ArgumentNullException("connectionString");

            if (String.IsNullOrWhiteSpace(databaseName) == true)
                throw new ArgumentNullException("databaseName");

            if (options == null)
                throw new ArgumentNullException("options");

            _connectionString = connectionString;
            _databaseName = databaseName;
            _options = options;

            Connection = new HangfireDbContext(connectionString, databaseName, options.Prefix);
            var defaultQueueProvider = new MongoJobQueueProvider(options);
            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
Example #25
0
        public SqlServerStorage(string connectionString, SqlServerStorageOptions options)
        {
            if (connectionString == null) throw new ArgumentNullException("connectionString");
            if (options == null) throw new ArgumentNullException("options");

            _options = options;
            _connectionString = connectionString;

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

            var defaultQueueProvider = new SqlServerJobQueueProvider(options);
            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
 public MongoConnection(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
     : this(database, new MongoStorageOptions(), queueProviders)
 {
 }
		private void InitializeQueueProviders()
		{
			var defaultQueueProvider = new PostgreSqlJobQueueProvider(_options);
			QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
		}
Example #28
0
 private void InitializeQueueProviders()
 {
     var defaultQueueProvider = new RavenJobQueueProvider(this, _options);
     QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
 }
Example #29
0
 public MongoWriteOnlyTransaction(HangfireDbContext connection,
                                  PersistentJobQueueProviderCollection queueProviders)
 {
     _connection     = connection ?? throw new ArgumentNullException(nameof(connection));
     _queueProviders = queueProviders ?? throw new ArgumentNullException(nameof(queueProviders));
 }
		public SQLiteConnection(
			IDbConnection connection,
			IsolationLevel? isolationLevel,
			PersistentJobQueueProviderCollection queueProviders)
			: this(connection, isolationLevel, queueProviders, true)
		{}
 public MongoMonitoringApi(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
 {
     _database       = database;
     _queueProviders = queueProviders;
 }
Example #32
0
        /// <summary>
        /// Ctor using default storage options
        /// </summary>
        public MongoConnection(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)

            : this(database, new MongoStorageOptions(), queueProviders)
        {
        }
 public MongoMonitoringApi(HangfireDbContext dbContext, PersistentJobQueueProviderCollection queueProviders)
 {
     _dbContext      = dbContext;
     _queueProviders = queueProviders;
 }
Example #34
0
        private void InitializeQueueProviders()
        {
            var defaultQueueProvider = new MySqlJobQueueProvider(_connectionString, _options);

            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
Example #35
0
 public CosmosDbConnection(CosmosDbStorage storage)
 {
     Storage        = storage;
     QueueProviders = storage.QueueProviders;
 }
Example #36
0
 public DocumentDbConnection(DocumentDbStorage storage)
 {
     Storage        = storage;
     QueueProviders = storage.QueueProviders;
 }
 private void InitializeQueueProviders()
 {
     QueueProviders =
         new PersistentJobQueueProviderCollection(
             new MySqlJobQueueProvider(this, _options));
 }
Example #38
0
        private void InitializeQueueProviders()
        {
            var defaultQueueProvider = new RavenJobQueueProvider(this, _options);

            QueueProviders = new PersistentJobQueueProviderCollection(defaultQueueProvider);
        }
 public FirebaseConnection(FirebaseStorage storage)
 {
     Client         = new FirebaseClient(storage.Config);
     QueueProviders = storage.QueueProviders;
     FireSharp.Extensions.ObjectExtensions.Serializer = new JsonSerializer();
 }
Example #40
0
        public MongoConnection(HangfireDbContext database, MongoStorageOptions options, PersistentJobQueueProviderCollection queueProviders)
        {
            if (database == null)
            {
                throw new ArgumentNullException("database");
            }

            if (queueProviders == null)
            {
                throw new ArgumentNullException("queueProviders");
            }

            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _database       = database;
            _options        = options;
            _queueProviders = queueProviders;
        }
 private void InitializeQueueProviders()
 {
     QueueProviders =
         new PersistentJobQueueProviderCollection(
             new FluentNHibernateJobQueueProvider(this));
 }
 public MySqlStorageConnection(string connectionString, 
     PersistentJobQueueProviderCollection queueProviders)
     : this(connectionString, queueProviders, true)
 {
 }