コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="storageOptions"></param>
 public LiteDbJobQueue(HangfireDbContext connection, LiteDbStorageOptions storageOptions)
 {
     _storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));
     _connection     = connection ?? throw new ArgumentNullException(nameof(connection));
 }
コード例 #2
0
 /// <summary>
 /// Opens connection to database
 /// </summary>
 /// <returns>Database context</returns>
 public HangfireDbContext CreateAndOpenConnection()
 {
     return(_connectionString != null
         ? HangfireDbContext.Instance(_connectionString, _storageOptions.Prefix)
         : null);
 }
コード例 #3
0
        /// <summary>
        /// Ctor using default storage options
        /// </summary>
        public LiteDbConnection(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)

            : this(database, new LiteDbStorageOptions(), queueProviders)
        {
        }
コード例 #4
0
 /// <summary>
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueProviders"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public LiteDbWriteOnlyTransaction(HangfireDbContext connection,
                                   PersistentJobQueueProviderCollection queueProviders)
 {
     _connection     = connection ?? throw new ArgumentNullException(nameof(connection));
     _queueProviders = queueProviders ?? throw new ArgumentNullException(nameof(queueProviders));
 }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 public LiteDbJobQueueMonitoringApi(HangfireDbContext connection)
 {
     _connection = connection ?? throw new ArgumentNullException(nameof(connection));
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <returns></returns>
 public IPersistentJobQueueMonitoringApi GetJobQueueMonitoringApi(HangfireDbContext connection)
 {
     return(new LiteDbJobQueueMonitoringApi(connection));
 }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <returns></returns>
 public IPersistentJobQueue GetJobQueue(HangfireDbContext connection)
 {
     return(new LiteDbJobQueue(connection, _storageOptions));
 }
コード例 #8
0
        private long GetNumberOfJobsByStateName(HangfireDbContext connection, string stateName)
        {
            var count = connection.Job.Count(_ => _.StateName == stateName);

            return(count);
        }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="database"></param>
 /// <param name="queueProviders"></param>
 public LiteDbMonitoringApi(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
 {
     _database       = database;
     _queueProviders = queueProviders;
 }
コード例 #10
0
        private long GetNumberOfJobsByStateName(HangfireDbContext connection, string stateName)
        {
            var count = connection.Job.Count(Query.EQ("StateName", stateName));

            return(count);
        }