Table of Contents

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

services IServiceCollection

The IServiceCollection to add services to.

taskName string

The case-sensitive name of the task.

task IApplicationTask

The task instance to execute.

Returns

IServiceCollection

The incoming services so 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

services IServiceCollection

The IServiceCollection to add services to.

taskName string

The case-sensitive name of the task.

factory Func<IServiceProvider, string, IApplicationTask>

The factory method that creates an IApplicationTask instance from an IServiceProvider and task name.

Returns

IServiceCollection

The incoming services so 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

services IServiceCollection

The IServiceCollection to add services to.

taskName string

The case-sensitive name of the task.

asyncAction Func<IServiceProvider, CancellationToken, Task>

The asynchronous action to execute.

Returns

IServiceCollection

The incoming services so 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

services IServiceCollection

The IServiceCollection to add services to.

taskName string

The case-sensitive name of the task.

Returns

IServiceCollection

The incoming services so that additional calls can be chained.

Type Parameters

T

The 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

services IServiceCollection

The IServiceCollection to add services to.

taskName string

The case-sensitive name of the task.

lifetime ServiceLifetime

The ServiceLifetime of the task.

Returns

IServiceCollection

The incoming services so that additional calls can be chained.

Type Parameters

T

The type of the task to execute.