/// <summary>
 /// Ctor using default storage options
 /// </summary>
 public HangfireSQLiteConnection(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
     : this(database, new SQLiteStorageOptions(), queueProviders)
 {
 }
 public IPersistentJobQueue GetJobQueue(HangfireDbContext connection)
 {
     return(new SQLiteJobQueue(connection, _storageOptions));
 }
 public IPersistentJobQueueMonitoringApi GetJobQueueMonitoringApi(HangfireDbContext connection)
 {
     return(new SQLiteJobQueueMonitoringApi(connection));
 }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="storageOptions"></param>
 public SQLiteJobQueue(HangfireDbContext connection, SQLiteStorageOptions storageOptions)
 {
     _storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));
     _dbContext      = connection ?? throw new ArgumentNullException(nameof(connection));
 }
Beispiel #5
0
 /// <summary>
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueProviders"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public SQLiteWriteOnlyTransaction(HangfireDbContext connection,
                                   PersistentJobQueueProviderCollection queueProviders)
 {
     _dbContext      = connection ?? throw new ArgumentNullException(nameof(connection));
     _queueProviders = queueProviders ?? throw new ArgumentNullException(nameof(queueProviders));
 }
 /// <summary>
 /// Opens connection to database
 /// </summary>
 /// <returns>Database context</returns>
 public HangfireDbContext CreateAndOpenConnection()
 {
     return(_connectionString != null
         ? HangfireDbContext.Instance(_connectionString, _storageOptions.Prefix)
         : null);
 }
        private long GetNumberOfJobsByStateName(HangfireDbContext connection, string stateName)
        {
            var count = connection.HangfireJobRepository.Count(_ => _.StateName == stateName);

            return(count);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="database"></param>
 /// <param name="queueProviders"></param>
 public SQLiteMonitoringApi(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
 {
     _dbContext      = database;
     _queueProviders = queueProviders;
 }