Class CommandPipelineCancellationExtensions

Namespace
Cratis.Arc.Commands
Assembly
Cratis.Arc.Core.dll

Extension methods for executing commands with an explicit cancellation token.

public static class CommandPipelineCancellationExtensions
Inheritance
CommandPipelineCancellationExtensions
Inherited Members

Methods

Execute(ICommandPipeline, object, IServiceProvider, ValidationResultSeverity?, CancellationToken)

Executes the given command within the provided service scope.

public static Task<CommandResult> Execute(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult>

A CommandResult representing the result of executing the command.

Execute(ICommandPipeline, object, IServiceProvider, CancellationToken)

Executes the given command within the provided service scope.

public static Task<CommandResult> Execute(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult>

A CommandResult representing the result of executing the command.

Execute(ICommandPipeline, object, ValidationResultSeverity?, CancellationToken)

Executes the given command, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult> Execute(this ICommandPipeline pipeline, object command, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult>

A CommandResult representing the result of executing the command.

Execute(ICommandPipeline, object, CancellationToken)

Executes the given command, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult> Execute(this ICommandPipeline pipeline, object command, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult>

A CommandResult representing the result of executing the command.

Execute<TResult>(ICommandPipeline, object, IServiceProvider, ValidationResultSeverity?, CancellationToken)

Executes the given command and returns a strongly-typed result within the provided service scope.

public static Task<CommandResult<TResult>> Execute<TResult>(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult<TResult>>

A CommandResult<TResponse> representing the result of executing the command.

Type Parameters

TResult

The type of the response returned by the command handler.

Execute<TResult>(ICommandPipeline, object, IServiceProvider, CancellationToken)

Executes the given command and returns a strongly-typed result within the provided service scope.

public static Task<CommandResult<TResult>> Execute<TResult>(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult<TResult>>

A CommandResult<TResponse> representing the result of executing the command.

Type Parameters

TResult

The type of the response returned by the command handler.

Execute<TResult>(ICommandPipeline, object, ValidationResultSeverity?, CancellationToken)

Executes the given command and returns a strongly-typed result, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult<TResult>> Execute<TResult>(this ICommandPipeline pipeline, object command, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult<TResult>>

A CommandResult<TResponse> representing the result of executing the command.

Type Parameters

TResult

The type of the response returned by the command handler.

Execute<TResult>(ICommandPipeline, object, CancellationToken)

Executes the given command and returns a strongly-typed result, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult<TResult>> Execute<TResult>(this ICommandPipeline pipeline, object command, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to execute.

cancellationToken CancellationToken

The cancellation token for the command execution.

Returns

Task<CommandResult<TResult>>

A CommandResult<TResponse> representing the result of executing the command.

Type Parameters

TResult

The type of the response returned by the command handler.

Validate(ICommandPipeline, object, IServiceProvider, ValidationResultSeverity?, CancellationToken)

Validates the given command without executing it, within the provided service scope.

public static Task<CommandResult> Validate(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to validate.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command validation.

Returns

Task<CommandResult>

A CommandResult representing the validation result.

Validate(ICommandPipeline, object, IServiceProvider, CancellationToken)

Validates the given command without executing it, within the provided service scope.

public static Task<CommandResult> Validate(this ICommandPipeline pipeline, object command, IServiceProvider serviceProvider, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to validate.

serviceProvider IServiceProvider

The IServiceProvider scoped to the current request, used to resolve handler dependencies.

cancellationToken CancellationToken

The cancellation token for the command validation.

Returns

Task<CommandResult>

A CommandResult representing the validation result.

Validate(ICommandPipeline, object, ValidationResultSeverity?, CancellationToken)

Validates the given command without executing it, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult> Validate(this ICommandPipeline pipeline, object command, ValidationResultSeverity? allowedSeverity, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to validate.

allowedSeverity ValidationResultSeverity?

Optional maximum validation result severity level to allow.

cancellationToken CancellationToken

The cancellation token for the command validation.

Returns

Task<CommandResult>

A CommandResult representing the validation result.

Validate(ICommandPipeline, object, CancellationToken)

Validates the given command without executing it, creating a dedicated service scope for dependency resolution.

public static Task<CommandResult> Validate(this ICommandPipeline pipeline, object command, CancellationToken cancellationToken)

Parameters

pipeline ICommandPipeline

The ICommandPipeline.

command object

The command to validate.

cancellationToken CancellationToken

The cancellation token for the command validation.

Returns

Task<CommandResult>

A CommandResult representing the validation result.