Class TaskServiceCollectionExtensions
- Namespace
- Steeltoe.Management.Tasks
- Assembly
- Steeltoe.Management.Tasks.dll
Provides extension methods to register an IApplicationTask in the service container.
public static class TaskServiceCollectionExtensions
- Inheritance
-
TaskServiceCollectionExtensions
- Inherited Members
Methods
AddTask(IServiceCollection, string, IApplicationTask)
Registers an application task instance that can be executed from the command line.
public static IServiceCollection AddTask(this IServiceCollection services, string taskName, IApplicationTask task)
Parameters
servicesIServiceCollectionThe IServiceCollection to add services to.
taskNamestringThe case-sensitive name of the task.
taskIApplicationTaskThe task instance to execute.
Returns
- IServiceCollection
The incoming
servicesso that additional calls can be chained.
AddTask(IServiceCollection, string, Func<IServiceProvider, string, IApplicationTask>)
Registers a factory for an application task that can be executed from the command line.
public static IServiceCollection AddTask(this IServiceCollection services, string taskName, Func<IServiceProvider, string, IApplicationTask> factory)
Parameters
servicesIServiceCollectionThe IServiceCollection to add services to.
taskNamestringThe case-sensitive name of the task.
factoryFunc<IServiceProvider, string, IApplicationTask>The factory method that creates an IApplicationTask instance from an IServiceProvider and task name.
Returns
- IServiceCollection
The incoming
servicesso that additional calls can be chained.
AddTask(IServiceCollection, string, Func<IServiceProvider, CancellationToken, Task>)
Registers an inline application task that can be executed from the command line.
public static IServiceCollection AddTask(this IServiceCollection services, string taskName, Func<IServiceProvider, CancellationToken, Task> asyncAction)
Parameters
servicesIServiceCollectionThe IServiceCollection to add services to.
taskNamestringThe case-sensitive name of the task.
asyncActionFunc<IServiceProvider, CancellationToken, Task>The asynchronous action to execute.
Returns
- IServiceCollection
The incoming
servicesso that additional calls can be chained.
AddTask<T>(IServiceCollection, string)
Registers an application task that can be executed from the command line.
public static IServiceCollection AddTask<T>(this IServiceCollection services, string taskName) where T : class, IApplicationTask
Parameters
servicesIServiceCollectionThe IServiceCollection to add services to.
taskNamestringThe case-sensitive name of the task.
Returns
- IServiceCollection
The incoming
servicesso that additional calls can be chained.
Type Parameters
TThe type of the task to execute.
AddTask<T>(IServiceCollection, string, ServiceLifetime)
Registers an application task that can be executed from the command line.
public static IServiceCollection AddTask<T>(this IServiceCollection services, string taskName, ServiceLifetime lifetime)
Parameters
servicesIServiceCollectionThe IServiceCollection to add services to.
taskNamestringThe case-sensitive name of the task.
lifetimeServiceLifetimeThe ServiceLifetime of the task.
Returns
- IServiceCollection
The incoming
servicesso that additional calls can be chained.
Type Parameters
TThe type of the task to execute.