Class CommandExtensions
Inheritance
System.Object
CommandExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public static class CommandExtensions
Methods
ExecuteAsync<TCommand>(TCommand, CancellationToken)
executes the command that does not return a result
Declaration
public static Task ExecuteAsync<TCommand>(this TCommand command, CancellationToken ct = default(CancellationToken))
where TCommand : ICommand
Parameters
Type | Name | Description |
---|---|---|
TCommand | command | the command to execute |
System.Threading.CancellationToken | ct | optional cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TCommand | the type of the command |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | thrown when a handler for the command cannot be instantiated |
ExecuteAsync<TResult>(ICommand<TResult>, CancellationToken)
executes the command and returns a result
Declaration
public static Task<TResult> ExecuteAsync<TResult>(this ICommand<TResult> command, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ICommand<TResult> | command | the command to execute |
System.Threading.CancellationToken | ct | optional cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult> |
Type Parameters
Name | Description |
---|---|
TResult | the type of the returned result |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | thrown when a handler for the command cannot be instantiated |