Skip to content

Instantly share code, notes, and snippets.

using System.Diagnostics;
using Hangfire.Client;
using Hangfire.Server;
using Hangfire.States;
using Hangfire.Storage;
namespace ActivitiesSupport
{
public sealed class DiagnosticsActivityFilter : IClientFilter, IServerFilter, IApplyStateFilter
{
// Copyright © 2020 Sergey Odinokov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the “Software”), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
@odinserj
odinserj / App.cs
Last active October 24, 2019 08:56
GlobalConfiguration.Configuration
.UseFilter(new OverrideJobIdFilter());
OverrideJobIdFilter.SetOverriddenId(Guid.Parse("266AC580-4FF9-4E72-B06A-CA20D7664B9E"));
BackgroundJob.Enqueue(() => Empty());
using System;
using System.Linq.Expressions;
using Hangfire.Annotations;
using Hangfire.Common;
using Hangfire.States;
namespace Hangfire
{
public static class RecurringJobManagerExtensions
{
using System;
using System.Web.Mvc;
using Hangfire;
namespace MyApplication
{
public class HomeController : Controller
{
private readonly IBackgroundJobClient _backgroundJobs;
// This file is part of Hangfire.
// Copyright © 2017 Sergey Odinokov.
//
// Hangfire is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3
// of the License, or any later version.
//
// Hangfire is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
public class MyAutofacActivator : JobActivator
{
private readonly ILifetimeScope _lifetimeScope;
public MyAutofacActivator(ILifetimeScope lifetimeScope)
{
_lifetimeScope = lifetimeScope;
}
public override JobActivatorScope BeginScope(JobActivatorContext context)
using System;
using System.Linq;
using Hangfire;
using Hangfire.Batches.Client;
using Hangfire.Client;
using Hangfire.Storage;
using Moq;
using Xunit;
namespace ClassLibrary1
using System;
using System.Linq;
using Hangfire;
using Hangfire.Batches.Client;
using Hangfire.Client;
using Hangfire.Storage;
using Moq;
using Xunit;
namespace ClassLibrary1
using System;
using System.Threading.Tasks;
using Hangfire;
using Hangfire.Common;
using Hangfire.States;
using Hangfire.Storage;
using Microsoft.Owin.Hosting;
using Owin;
namespace ConsoleApp71