Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 896 Bytes

File metadata and controls

17 lines (14 loc) · 896 Bytes

SimpleLoops

Library for running async loops

How to use it

AsyncLoopsBackgroundService detects all IAsyncLoop service registrations (such as services.AddSingleton<IAsyncLoop, AsyncLoop()) and run them.
At minimum, the following services needs to be registered:

services.AddHostedService<AsyncLoopsBackgroundService>();     /* background service which runs the loops */
services.AddSingleton<IAsyncLoop, AsyncLoop>();               /* custom async loop, expending `AsyncLoopBase` or implementing `IAsyncLoop` */
services.AddSingleton<AsyncLoopConfiguration>();              /* only if applied to all async loops */

/* dependencies */
services.AddSingleton<ITask, TaskDelayWrapper>();
services.AddSingleton<IDateTime, DateTimeWrapper>();

Code sample