Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 10, 2016 01:43
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/8228fc8c8ed54fd3de3442102a064e0d to your computer and use it in GitHub Desktop.
Save dcomartin/8228fc8c8ed54fd3de3442102a064e0d to your computer and use it in GitHub Desktop.
using Hangfire.Common;
using Hangfire.MediatR;
using MediatR;
using Newtonsoft.Json;
namespace Hangfire
{
public static class HangfireExtensions
{
public static IGlobalConfiguration UseMediatR(this IGlobalConfiguration config, IMediator mediator)
{
config.UseActivator(new MediatRJobActivator(mediator));
JobHelper.SetSerializerSettings(new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Objects,
});
return config;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment