Skip to content

Commit

Permalink
GitBook: [master] one page modified
Browse files Browse the repository at this point in the history
  • Loading branch information
mynkow authored and gitbook-bot committed Oct 1, 2020
1 parent 7026f5d commit ccd6f15
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions docs/message-types/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@

A command is used to dispatch domain model changes. It can be accepted or rejected depending on the domain model invariants.

## Communication Guide Table

| Triggered by | Description |
| :---: | :--- |
| UI | It is NOT common practice to send commands directly from the UI. Usually the UI communicates with web APIs. |
| UI | It is NOT common practice to send commands directly from the UI. Usually the UI communicates with web APIs |
| API | APIs sit in the middle between UI and Server translating web requests into commands |
| External System | It is NOT common practice to send commands directly from the External System. Usually the External System communicates with web APIs. |
| Port | Ports are a simple way for an aggregate root to communicate with another aggregate root. |
| Saga | Sagas are a simple way for an aggregate root to do complex communication with other aggregate roots. |

## Best Practices

{% hint style="success" %}
**You can/should/must...**

* a command must be immutable
* a command must clearly state a business intent with a name in imperative form
* a command can be rejected due to domain validation, error or other reason
* a command must update only one AggregateRoot
* a command **must** be immutable
* a command **must** clearly state a business intent with a name in imperative form
* a command **can** be rejected due to domain validation, error or other reason
* a command **must** update only one AggregateRoot
{% endhint %}

## Examples

```csharp
public class DeactivateAccount : ICommand
{
Expand Down

0 comments on commit ccd6f15

Please sign in to comment.