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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe cancellation token for the command execution.
Returns
- Task<CommandResult<TResult>>
A CommandResult<TResponse> representing the result of executing the command.
Type Parameters
TResultThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
cancellationTokenCancellationTokenThe cancellation token for the command execution.
Returns
- Task<CommandResult<TResult>>
A CommandResult<TResponse> representing the result of executing the command.
Type Parameters
TResultThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe cancellation token for the command execution.
Returns
- Task<CommandResult<TResult>>
A CommandResult<TResponse> representing the result of executing the command.
Type Parameters
TResultThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to execute.
cancellationTokenCancellationTokenThe cancellation token for the command execution.
Returns
- Task<CommandResult<TResult>>
A CommandResult<TResponse> representing the result of executing the command.
Type Parameters
TResultThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to validate.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to validate.
serviceProviderIServiceProviderThe IServiceProvider scoped to the current request, used to resolve handler dependencies.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to validate.
allowedSeverityValidationResultSeverity?Optional maximum validation result severity level to allow.
cancellationTokenCancellationTokenThe 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
pipelineICommandPipelineThe ICommandPipeline.
commandobjectThe command to validate.
cancellationTokenCancellationTokenThe cancellation token for the command validation.
Returns
- Task<CommandResult>
A CommandResult representing the validation result.