Command Design Survey
February 28, 2011
Posted by on
A while back, I did a command design survey to get a feeling as to how people were designing their commands in a CQRS environment. A total of 28 people participated in the survey (excluding myself, as I didn’t want to bias the results in any way). I want to thank each one of you for taking the time to do so. Here are the results:
To the question “What else is special about your commands?” I got this compiled list:
- For now I use what ncqrs requires
- They contain correlation id, user, role, time stamp, context reference
- Use data annotations for validations. Commands are treated as value objects.
- They are DTOs, no behaviour
- Nothing, they are just standard nCQRS CommandBase implementations at the moment.
- Simple, no behavior in commands, handlers may throw.
- Validates them using a nsb message mutator on the sending side and a msg handler on the receiving side
- Immutable, self describing, explicit
- They are dead simple 🙂
- The base class/interface contains an Id property of type Guid.
- Getters/Setters to use the command as the ASP.NET MVC view model;nCQRS base class has a marker interface, so both really.;No constructor, so no exception from the constructor. Validation is done by ASP.NET MVC so the user can see the validation errors. I validate again in a command service interceptor, to catch base commands from other sources.
- I have a ICommand.Validate method that gets called by the dispatcher (returns IEnumerable)
Come to your own conclusions.