Hangfire.Stashbox 1.0.2

Package Description

Install-Package Hangfire.Stashbox -Version 1.0.2
dotnet add package Hangfire.Stashbox --version 1.0.2
<PackageReference Include="Hangfire.Stashbox" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hangfire.Stashbox --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

stashbox-hangfire

Appveyor build status Travis CI build status NuGet Version

This project provides Stashbox integration for Hangfire, using Stashbox container and Scopes to resolve jobs and their dependencies.

Common usage

To integrate Stashbox as the default JobActivator into Hangfire, you can use the UseStashboxActivator extension method on the IGlobalConfiguration interface.

var container = new StashboxContainer();

GlobalConfiguration.Configuration.UseStashboxActivator(container);

ASP.NET Core

As the ASP.NET Core extension of Hangfire uses the configured IServiceProvider to resolve jobs through an AspNetCoreJobActivator, so for using Stashbox as the default job activator you can simply just use the ASP.NET Core integration of Stashbox which will replace the default IServiceProvider with a Stashbox container.

However you also have the option to tell Hangfire that it should use the StashboxJobActivator directly.

public IServiceProvider ConfigureService(IServiceCollection services)
{
    services.AddHangfire((provider, config) => 
        config.UseStashboxActivator(provider.GetService<IDependencyResolver>()));

    return services.UseStashbox();
}

.NET Generic Host

using (var host = new HostBuilder()
    .UseStashbox()
    .ConfigureContainer<IStashboxContainer>((context, container) =>
    {
        container.Register<JobActivator, StashboxJobActivator>();
    })
    .ConfigureServices((context, services) =>
    {
        services.AddHangfireServer();
    })
    .Build())
{
    // start and use your host
}

stashbox-hangfire

Appveyor build status Travis CI build status NuGet Version

This project provides Stashbox integration for Hangfire, using Stashbox container and Scopes to resolve jobs and their dependencies.

Common usage

To integrate Stashbox as the default JobActivator into Hangfire, you can use the UseStashboxActivator extension method on the IGlobalConfiguration interface.

var container = new StashboxContainer();

GlobalConfiguration.Configuration.UseStashboxActivator(container);

ASP.NET Core

As the ASP.NET Core extension of Hangfire uses the configured IServiceProvider to resolve jobs through an AspNetCoreJobActivator, so for using Stashbox as the default job activator you can simply just use the ASP.NET Core integration of Stashbox which will replace the default IServiceProvider with a Stashbox container.

However you also have the option to tell Hangfire that it should use the StashboxJobActivator directly.

public IServiceProvider ConfigureService(IServiceCollection services)
{
    services.AddHangfire((provider, config) => 
        config.UseStashboxActivator(provider.GetService<IDependencyResolver>()));

    return services.UseStashbox();
}

.NET Generic Host

using (var host = new HostBuilder()
    .UseStashbox()
    .ConfigureContainer<IStashboxContainer>((context, container) =>
    {
        container.Register<JobActivator, StashboxJobActivator>();
    })
    .ConfigureServices((context, services) =>
    {
        services.AddHangfireServer();
    })
    .Build())
{
    // start and use your host
}

Version History

Version Downloads Last updated
1.0.2 50 5/9/2019