Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created September 30, 2020 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/cc95718ca86bb41dec2ec3efe09d9a9d to your computer and use it in GitHub Desktop.
Save dcomartin/cc95718ca86bb41dec2ec3efe09d9a9d to your computer and use it in GitHub Desktop.
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