This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE TABLE [dbo].[__MigrationJournal]( | |
| [Id] [int] IDENTITY(1,1) NOT NULL, | |
| [ScriptName] [nvarchar](255) NOT NULL, | |
| [Applied] [datetime] NOT NULL, | |
| CONSTRAINT [PK___MigrationJournal_Id] PRIMARY KEY CLUSTERED | |
| ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TRUNCATE TABLE [HangFire].[AggregatedCounter] | |
| TRUNCATE TABLE [HangFire].[Counter] | |
| TRUNCATE TABLE [HangFire].[JobParameter] | |
| TRUNCATE TABLE [HangFire].[JobQueue] | |
| TRUNCATE TABLE [HangFire].[List] | |
| TRUNCATE TABLE [HangFire].[State] | |
| DELETE FROM [HangFire].[Job] | |
| DBCC CHECKIDENT ('[HangFire].[Job]', reseed, 0) | |
| UPDATE [HangFire].[Hash] SET Value = 1 WHERE Field = 'LastJobId' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [StronglyTypedId(jsonConverter: StronglyTypedIdJsonConverter.SystemTextJson)] | |
| public partial struct UserId | |
| { | |
| } | |
| public class StronglyTypedIdHelper | |
| { | |
| public UserId CreateUserId() | |
| { | |
| return new UserId(Guid.NewGuid()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [AttributeUsage(AttributeTargets.All)] | |
| public sealed class HangfireCustomExpirationAttribute : JobFilterAttribute, IApplyStateFilter | |
| { | |
| private readonly int _jobExpirationInMinutes; | |
| public HangfireCustomExpirationAttribute(int jobExpirationTimeoutInMinutes = 60) | |
| { | |
| _jobExpirationInMinutes = jobExpirationTimeoutInMinutes; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [AttributeUsage(AttributeTargets.All)] | |
| public sealed class HangfireProlongJobExpirationAttribute : JobFilterAttribute, IApplyStateFilter | |
| { | |
| private readonly int _expirationTimeoutInDays; | |
| public HangfireProlongJobExpirationAttribute(int expirationTimeoutInDays = 30) | |
| { | |
| _expirationTimeoutInDays = expirationTimeoutInDays; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class HangfireConfig | |
| { | |
| public static void AddHangfire(this IServiceCollection services, IConfiguration configuration) | |
| { | |
| Log.Information("Configuring hangfire..."); | |
| services.AddScoped<IBackgroundJobWorker, HangfireBackgroundJobManager>(); | |
| services.AddHangfire(config => config | |
| .SetDataCompatibilityLevel(CompatibilityLevel.Version_170) |