Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created September 30, 2020 21:12
Embed
What would you like to do?
using MediatR;
namespace Hangfire.MediatR
{
public static class MediatorExtensions
{
public static void Enqueue(this IMediator mediator, string jobName, IRequest request)
{
var client = new BackgroundJobClient();
client.Enqueue<MediatorHangfireBridge>(bridge => bridge.Send(jobName, request));
}
public static void Enqueue(this IMediator mediator,IRequest request)
{
var client = new BackgroundJobClient();
client.Enqueue<MediatorHangfireBridge>(bridge => bridge.Send(request));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment