Centeva.Hangfire.HangfireScheduler 1.0.4

Prefix Reserved
dotnet add package Centeva.Hangfire.HangfireScheduler --version 1.0.4
                    
NuGet\Install-Package Centeva.Hangfire.HangfireScheduler -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Centeva.Hangfire.HangfireScheduler" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Centeva.Hangfire.HangfireScheduler" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Centeva.Hangfire.HangfireScheduler" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Centeva.Hangfire.HangfireScheduler --version 1.0.4
                    
#r "nuget: Centeva.Hangfire.HangfireScheduler, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Centeva.Hangfire.HangfireScheduler@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Centeva.Hangfire.HangfireScheduler&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Centeva.Hangfire.HangfireScheduler&version=1.0.4
                    
Install as a Cake Tool

Centeva.Hangfire.HangfireScheduler

Provides abstractions and base implementations for configuring, scheduling, and managing Hangfire background tasks in .NET 8+ applications. Includes support for dependency injection and customizable task registration for both web and background processing scenarios.

Features

  • Base class for defining and registering Hangfire background tasks
  • Extension methods for easy DI registration
  • Support for custom Hangfire task implementations
  • Designed for .NET 8 and modern dependency injection patterns

Installation

Add the NuGet package to your project:

dotnet add package Centeva.Hangfire.HangfireScheduler

Usage

1. Register Services in Dependency Injection

In your application's startup code (e.g., Program.cs or Startup.cs), register the scheduler and your custom tasks as singleton services:

using Centeva.Hangfire.HangfireScheduler;
// Register the HangfireScheduler as a singleton services.AddHangfireScheduler();
// Register your concrete HangfireTasks implementation as a singleton services.AddHangfireTasks<MyHangfireTasks>();

Note: Most applications will register both HangfireScheduler and their own implementation of IHangfireTasks as singletons using the provided extension methods (AddHangfireScheduler and AddHangfireTasks<T>). If you do not use these extension methods, you must register these services manually in your dependency injection setup.

2. Implement Your Hangfire Tasks

Create a class that inherits from HangfireTasks and implements the required RegisterTasks method:

public class MyHangfireTasks : HangfireTasks
{
    public MyHangfireTasks(IServiceProvider sp, IOptions<IHangfireConfig> config) : base(sp, config) { }
    public override void RegisterTasks()
    {
        // Register your recurring or background jobs here
    }
}

3. Configuration

Implement the IHangfireConfig interface to provide configuration options for Hangfire, such as enabling/disabling jobs and dashboard access.

public class MyHangfireConfig : IHangfireConfig
{
    public bool Enabled { get; init; }
    public string[] DashboardAccess { get; init; }
    public string ConfigurationKey => "Hangfire"; 
}

Note: The ConfigurationKey property in your IHangfireConfig implementation determines which section of your appsettings.json is used for Hangfire configuration. By default, it is set to "Hangfire", but you can override this property if your configuration section uses a different name.

Extension Methods

  • AddHangfireScheduler()
    Registers the HangfireScheduler as a singleton.

  • AddHangfireTasks<T>()
    Registers your concrete implementation of HangfireTasks and IHangfireTasks as singletons.

Best Practices

  • Always register HangfireScheduler and your IHangfireTasks implementation as singletons.
  • Use the provided extension methods for consistent and easy DI setup.
  • Use the configuration interface to control job enablement and dashboard access.

Dependencies

License

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 199 1/20/2026
1.0.3 275 12/4/2025
1.0.2 395 12/3/2025 1.0.2 is deprecated because it has critical bugs.
1.0.1 343 12/3/2025 1.0.1 is deprecated because it has critical bugs.
1.0.0 821 12/2/2025 1.0.0 is deprecated because it has critical bugs.