Masterly.NightShift.NetCore
1.0.0
dotnet add package Masterly.NightShift.NetCore --version 1.0.0
NuGet\Install-Package Masterly.NightShift.NetCore -Version 1.0.0
<PackageReference Include="Masterly.NightShift.NetCore" Version="1.0.0" />
<PackageVersion Include="Masterly.NightShift.NetCore" Version="1.0.0" />
<PackageReference Include="Masterly.NightShift.NetCore" />
paket add Masterly.NightShift.NetCore --version 1.0.0
#r "nuget: Masterly.NightShift.NetCore, 1.0.0"
#:package Masterly.NightShift.NetCore@1.0.0
#addin nuget:?package=Masterly.NightShift.NetCore&version=1.0.0
#tool nuget:?package=Masterly.NightShift.NetCore&version=1.0.0
Masterly.NightShift.NetCore
Microsoft.Extensions integration for Masterly.NightShift: AddNightShift and AddNightShiftServer for dependency injection, job classes created from your container with a scope per job, logging through ILogger, and the job server as a hosted service. Use it in Worker Services and other Generic Host apps.
This is a package of Masterly.NightShift, reliable background jobs for .NET.
Install
ASP.NET Core apps get this package through Masterly.NightShift. For a Worker Service, add it with a storage:
dotnet add package Masterly.NightShift.NetCore
dotnet add package Masterly.NightShift.SqlServer
- Target frameworks:
net8.0,net10.0 - Dependencies:
Masterly.NightShift.Core, and theMicrosoft.Extensions.DependencyInjection,HostingandLoggingabstractions: 8.0.x onnet8.0, 10.0.x onnet10.0, so your app keeps its runtime's versions
Example
A Worker Service that runs jobs, with the job classes created from the container:
using Masterly.NightShift;
var builder = Host.CreateApplicationBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("NightShift")
?? throw new InvalidOperationException("Connection string 'NightShift' is missing.");
builder.Services.AddNightShift(config => config
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage(connectionString));
builder.Services.AddNightShiftServer(options =>
{
options.WorkerCount = 4;
});
builder.Services.AddTransient<ReportService>();
var host = builder.Build();
host.Services.GetRequiredService<IRecurringJobManager>()
.AddOrUpdate<ReportService>("daily-report", x => x.BuildDaily(), Cron.Daily(6));
host.Run();
public class ReportService
{
private readonly ILogger<ReportService> _logger;
public ReportService(ILogger<ReportService> logger) => _logger = logger;
public void BuildDaily() => _logger.LogInformation("Daily report built");
}
Each job runs inside a logging scope with its job id and name.
Documentation
What AddNightShift and AddNightShiftServer register, job activation and scopes, and server options from configuration are covered in the full documentation: https://a7mdfre7at.github.io/Masterly.NightShift/docs/server/dependency-injection
License
MIT AND LGPL-3.0-or-later: code written for Masterly.NightShift is MIT, code derived from Hangfire stays under the LGPL. The package contains both license texts.
| Product | Versions 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 is compatible. 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. |
-
net10.0
- Masterly.NightShift.Core (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.15)
-
net8.0
- Masterly.NightShift.Core (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Masterly.NightShift.NetCore:
| Package | Downloads |
|---|---|
|
Masterly.NightShift.AspNetCore
Masterly.NightShift for ASP.NET Core: the dashboard as an endpoint or middleware, health checks, and /health and Prometheus /metrics endpoints. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 0 | 11/16/2026 |
Release notes for version 1.0.0: https://github.com/a7mdfre7at/Masterly.NightShift/blob/master/CHANGELOG.md