Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IeuanWalker/Hangfire.RecurringJob
Automatically generates the recurring job registration code using source generators
https://github.com/IeuanWalker/Hangfire.RecurringJob
hangfire recurring-jobs source-generator
Last synced: about 1 month ago
JSON representation
Automatically generates the recurring job registration code using source generators
- Host: GitHub
- URL: https://github.com/IeuanWalker/Hangfire.RecurringJob
- Owner: IeuanWalker
- License: mit
- Created: 2023-09-27T15:59:50.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-19T07:45:09.000Z (8 months ago)
- Last Synced: 2024-11-08T00:43:47.440Z (about 1 month ago)
- Topics: hangfire, recurring-jobs, source-generator
- Language: C#
- Homepage:
- Size: 85 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - https://github.com/IeuanWalker/Hangfire.RecurringJob
- csharp-source-generators - Hangfire.RecurringJob - ![stars](https://img.shields.io/github/stars/IeuanWalker/Hangfire.RecurringJob?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/IeuanWalker/Hangfire.RecurringJob?style=flat-square&cacheSeconds=86400) - Automatically generates the recurring job registration code. (Source Generators / Other)
README
# Hangfire.RecurringJob [![Nuget](https://img.shields.io/nuget/v/IeuanWalker.Hangfire.RecurringJob)](https://www.nuget.org/packages/IeuanWalker.Hangfire.RecurringJob) [![Nuget](https://img.shields.io/nuget/dt/IeuanWalker.Hangfire.RecurringJob)](https://www.nuget.org/packages/IeuanWalker.Hangfire.RecurringJob)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Build](https://github.com/IeuanWalker/Hangfire.RecurringJob/actions/workflows/build.yml/badge.svg)](https://github.com/IeuanWalker/Hangfire.RecurringJob/actions/workflows/build.yml)Automatically generates the recurring job registration code using source generators
## How to use it?
1. Install the [NuGet package](https://www.nuget.org/packages/IeuanWalker.Hangfire.RecurringJob) into your project.
```
Install-Package IeuanWalker.Hangfire.RecurringJob
```2. Add the `RecurringJob` attribute to a class, and create an `Execute()` method.
```csharp
[RecurringJob]
public class RecurringJob1
{
public Task Execute()
{
throw new NotImplementedException();
}
}[RecurringJob("* * * *")]
public class RecurringJob2
{
public void Execute()
{
throw new NotImplementedException();
}
}[RecurringJob("* * * *", "Priority")]
public class RecurringJob3
{
public void Execute()
{
throw new NotImplementedException();
}
}[RecurringJob]
[RecurringJob("*/5 * * * *", "GMT", "Priority", "DataRetention")]
public class RecurringJob4
{
public void Execute()
{
throw new NotImplementedException();
}
}
```
3. Register the recurring jobs
> Once a `RecurringJob` attribute has been added to a class in your project an extension method for `IApplicationBuilder` will automatically be created.
> The extension method name convention is AddRecurringJobsFrom + your assembly name.
```csharp
app.AddRecurringJobsFromExampleProject();
```## Example
Here is an example of what it looks like in use -
> Left is the example code, and right is the generated code![image](https://github.com/IeuanWalker/Hangfire.RecurringJob.Generator/assets/6544051/cef12771-5178-46cf-9264-dbb54654efc6)