Table of Contents

Class TaskServiceCollectionExtensions

Namespace
Steeltoe.Management.TaskCore
Assembly
Steeltoe.Management.TaskCore.dll
public static class TaskServiceCollectionExtensions
Inheritance
TaskServiceCollectionExtensions
Inherited Members

Methods

AddTask(IServiceCollection, IApplicationTask)

Register a one-off task that can be executed from command line

public static void AddTask(this IServiceCollection services, IApplicationTask task)

Parameters

services IServiceCollection

Service container

task IApplicationTask

Task instance

AddTask(IServiceCollection, Func<IServiceProvider, IApplicationTask>, ServiceLifetime)

Register a one-off task that can be executed from command line

public static void AddTask(this IServiceCollection services, Func<IServiceProvider, IApplicationTask> factory, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

Service container

factory Func<IServiceProvider, IApplicationTask>

A factory method to create an application task

lifetime ServiceLifetime

Task lifetime

AddTask(IServiceCollection, string, Action<IServiceProvider>, ServiceLifetime)

Register a one-off task that can be executed from command line

public static void AddTask(this IServiceCollection services, string name, Action<IServiceProvider> runAction, ServiceLifetime lifetime = ServiceLifetime.Singleton)

Parameters

services IServiceCollection

Service container

name string

Well known name of the task. This is how it's identified when called

runAction Action<IServiceProvider>

Task method body

lifetime ServiceLifetime

Task lifetime

AddTask<T>(IServiceCollection, ServiceLifetime)

Register a one-off task that can be executed from command line

public static void AddTask<T>(this IServiceCollection services, ServiceLifetime lifetime = ServiceLifetime.Singleton) where T : class, IApplicationTask

Parameters

services IServiceCollection

Service container

lifetime ServiceLifetime

Task lifetime

Type Parameters

T

Task implementation