How to match EditModel with message commands?

Jimmy Bogard at Los Techies says he matches his EditModel with message commands instead of matching EditModel with DomainModel. Can anyone explain this further?

+3
source share
1 answer

I would suggest that this will be a version of the template that performs the necessary manipulations with the corresponding domain objects based on the provided message. for example, something like

public PromoteEmployeeCommand : ICommand {
     private readonly PromotionMessage _message;
     private readonly IEmployeeRepository _repository;

     public PromoteEmployeeCommand(PromotionMessage message,
                                   IEmployeeRepository repository) {
          _message = message;
          _repository = repository;
     }

     public void Execute() {
          /* Get the employee, give them a rise etc... */
     }
}

, (, , , ..).

, , Edit.

+4

Source: https://habr.com/ru/post/1725619/


All Articles