Skip to content

v6.0: Big changes

Compare
Choose a tag to compare
@justdmitry justdmitry released this 18 Oct 09:34
· 30 commits to master since this release
v6.0.0

1. IApplicationLifetime

Main reason of this version is IApplicationLifetime support (Issue #5) for better ASP.NET Core 2.1+ interaction. Now there is no more need for app.StartTask calls in your Startup.Configure - you need only services.AddTask<>(...) in Startup.ConfigureServices, and your task will be started/stopped automatically.

Doe to above, all configuration is moved to AddTask, so simplest task registration look like:

services.AddTask<SampleTask>(o => o.AutoStart(15)); // 15 min, TimeSpan also allowed

All additional configuration (Culture, FirstRunDelay, before/after handlers etc) should be done here. Please note slight property name changes.

2. ITask.Options

All configurable task options now available from ITask.Options property (e.g. for changing Interval from inside the task use currentTask.Options.Interval instead of currentTask.Interval) - that's breaking change you should pay attention to and update your tasks accordingly. Sorry.

3. ASP.NET Core 2.1 and netstandard2.0

As soon as IApplicationLifetime is supported only in ASP.NET Core 2.1 and above - depended libraries are upgraded to 2.1.0, and only netstandard2.0 target framework is supported (for netstartard1.0 and net46x use previous version).

4. Minor improvements

  • [Issue #6] ITask now have RunnableType read-only property, which returns typeof(TRunnable). This may be used for logging purposes etc.