Laim.Hangfire.LiteDB 1.0.0

dotnet add package Laim.Hangfire.LiteDB --version 1.0.0
                    
NuGet\Install-Package Laim.Hangfire.LiteDB -Version 1.0.0
                    
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="Laim.Hangfire.LiteDB" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Laim.Hangfire.LiteDB" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Laim.Hangfire.LiteDB" />
                    
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 Laim.Hangfire.LiteDB --version 1.0.0
                    
#r "nuget: Laim.Hangfire.LiteDB, 1.0.0"
                    
#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 Laim.Hangfire.LiteDB@1.0.0
                    
#: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=Laim.Hangfire.LiteDB&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Laim.Hangfire.LiteDB&version=1.0.0
                    
Install as a Cake Tool

Laim.Hangfire.LiteDB

A maintained fork of Hangfire.LiteDB, providing LiteDB job storage for Hangfire.

NuGet package: Laim.Hangfire.LiteDB

Compatibility: The assembly name and C# namespace remain Hangfire.LiteDB. Replace the old package reference, not your using Hangfire.LiteDB; statements or existing UseLiteDbStorage(...) calls.

Dependencies and targets

Component Version / target
Library target .NET Standard 2.0 (usable from .NET 10)
Hangfire.Core 1.8.25
LiteDB 5.0.21
Newtonsoft.Json 13.0.4
Sample applications and tests .NET 10

This fork targets Hangfire 1.8 and removes the obsolete .NET Framework 4.5 / .NET Core 2.x build targets.

Installation

Install the package from NuGet.org using the .NET CLI:

dotnet add package Laim.Hangfire.LiteDB

Or add the package reference directly to your project file:

<PackageReference Include="Laim.Hangfire.LiteDB" Version="1.0.0" />

If you currently use the original Hangfire.LiteDB package, remove it before installing Laim.Hangfire.LiteDB. Do not reference both packages, as they share the same assembly name.

No changes to your existing using Hangfire.LiteDB; statements or UseLiteDbStorage(...) calls are needed.

Configure Hangfire

If this is your first time using Laim.Hangfire.LiteDB OR Hangfire.LiteDB in ASP.NET Core, I wrote a tutorial a while ago. You can find it here

In ASP.NET Core:

using Hangfire;
using Hangfire.LiteDB;

builder.Services.AddHangfire(config =>
{
    config.UseSimpleAssemblyNameTypeSerializer()
        .UseRecommendedSerializerSettings()
        .UseLiteDbStorage("app/hangfire.db"); // You can make this whatever you want and store the string however you want, i.e appsettings.json 
});

builder.Services.AddHangfireServer();

Enqueue and schedule jobs through Hangfire as usual:

BackgroundJob.Enqueue(() => Console.WriteLine("Hello from Hangfire"));
BackgroundJob.Schedule(() => Console.WriteLine("Later"), TimeSpan.FromDays(1));


var recurringJobManager = app.ApplicationServices.GetRequiredService<IRecurringJobManager>();

// run the job every minute, if you don't understand cron you can use https://cronguru.com
// reconisiable-job-id shows up in the hangfire dashboard, so name it something you'll recognize such as
// weekly-db-backup, monthly-statistics-report, etc.
recurringJobManager.AddOrUpdate("recognizable-job-id", () => Test(), "* * * * *");

You can also enable the Hangfire Dashboard using the below, it is recommended to wrap this in an Authentication, as it is unauthenticated by default.

// This is unauthenticated by default, anyone will be able to view and run jobs
//  if you do not put an AuthorizationFilter infront of it!
app.UseHangfireDashboard();

For console applications, explicitly instantiate BackgroundJobServer (see samples/ConsoleSample).

Migration and operational considerations

  • Back up the existing LiteDB database before switching packages. This fork retains the storage schema, assembly name, default table prefixes and public API, but a migration must be tested with your actual data and workload.

  • Hangfire 1.8 changes some scheduling and serialization defaults. See the official Hangfire 1.8 upgrade guide. Avoid simultaneously enabling new 1.8 data-compatibility/serializer settings during the package swap; change them separately and test existing jobs.

  • A Hangfire distributed-lock timeout must report the lock resource, not a formatted diagnostic string. The provider contains this required Hangfire 1.8 compatibility adjustment.

  • LiteDB is a file-based store. Its performance, single-file concurrency and multi-process access characteristics are different from SQL Server/Redis. Upgrading dependencies does not guarantee that existing storage-provider issues (e.g., queue visibility, stuck locks or monitoring API coverage) are resolved. Test job processing, retries, recurring jobs, locks, dashboard queries and shutdown/restart behaviour before production rollout.

  • Do not run the old and new package in different server instances against the same database until you have tested that exact deployment arrangement. Stop workers and take a backup during the migration.

Build and test

Install the .NET 10 SDK.

# Build all projects, including samples
dotnet restore Hangfire.LiteDB.sln
dotnet build Hangfire.LiteDB.sln --configuration Release --no-restore

# Run the existing test suite
dotnet test test/Hangfire.LiteDB.Test/Hangfire.LiteDB.Test.csproj --configuration Release --no-build

# Check known NuGet advisories (including transitive dependencies)
dotnet list Hangfire.LiteDB.sln package --vulnerable --include-transitive

Attribution and license

Forked from codeyu/Hangfire.LiteDB and distributed under the MIT License. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0 125 10/25/2026