Passing CQRS commands directly to Domain objects

前端 未结 2 787
终归单人心
终归单人心 2021-02-03 11:58

~TLDR: I\'m implementing a CQRS + DDD solution for one of my larger projects, and, I\'m wondering if there is any real reason that my command handlers can\'t directly dispatch t

2条回答
  •  难免孤独
    2021-02-03 12:35

    Agree with @plalx.

    Take commands as aggregate method arguments may lead to having too many mapping codes inside aggregates: Mapping primitive types to domain objects, which is better to be placed out of the domain objects.

    But for simpler projects, I think it is good starter.

    In registration case, the bounded context is usually a supporting domain and the complexity usually comes from external integration(email notification, register with social accounts, etc). In this case, I think bounded context integration is more important than the models inside. So take commands as aggregate method arguments may be a quick start to get things done and saves your time to focus on your core domain.

提交回复
热议问题