| | | 1 | | using Elsa.Mediator.Contracts; |
| | | 2 | | |
| | | 3 | | namespace Elsa.Mediator.Middleware.Command; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Provides context for a command. |
| | | 7 | | /// </summary> |
| | | 8 | | public class CommandContext |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Initializes a new instance of the <see cref="CommandContext"/> class. |
| | | 12 | | /// </summary> |
| | 55 | 13 | | public CommandContext(ICommand command, ICommandStrategy commandStrategy, Type resultType, IDictionary<object, objec |
| | | 14 | | { |
| | 55 | 15 | | Command = command; |
| | 55 | 16 | | CommandStrategy = commandStrategy; |
| | 55 | 17 | | ResultType = resultType; |
| | 55 | 18 | | Headers = headers; |
| | 55 | 19 | | ServiceProvider = serviceProvider; |
| | 55 | 20 | | CancellationToken = cancellationToken; |
| | 55 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the command. |
| | | 25 | | /// </summary> |
| | 253 | 26 | | public ICommand Command { get; init; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the command strategy. |
| | | 30 | | /// </summary> |
| | 55 | 31 | | public ICommandStrategy CommandStrategy { get; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets or sets the headers associated with the command context. |
| | | 35 | | /// </summary> |
| | 22 | 36 | | public IDictionary<object, object> Headers { get; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the service provider used to resolve services for the command context. |
| | | 40 | | /// </summary> |
| | 55 | 41 | | public IServiceProvider ServiceProvider { get; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets the result type. |
| | | 45 | | /// </summary> |
| | 110 | 46 | | public Type ResultType { get; init; } |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Gets the cancellation token. |
| | | 50 | | /// </summary> |
| | 165 | 51 | | public CancellationToken CancellationToken { get; init; } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Gets or sets the result. |
| | | 55 | | /// </summary> |
| | 132 | 56 | | public object? Result { get; set; } |
| | | 57 | | } |