Timer with a scoped lifecycle per each call.
License
—
Deps
2
Install Size
—
Vulns
✓ 0
Published
Oct 27, 2023
$ dotnet add package rmdev.ScopedTimerHostedServiceLibrary to allow adding timers with scoped lifecycle and concurrency control.
using rmdev.ScopedTimerHostedService;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IService, Service>();
builder.Services.AddScopedTimer<IService>(service => service.DoSomething(), 5000);
// ...
Check example project for more detailed examples