How to avoid anemic domain models, or when to move methods from the entities into services

前端 未结 5 1097
悲&欢浪女
悲&欢浪女 2021-01-29 22:19

I have a common scenario that I am looking for some guidance from people more experienced with DDD and Domain Modeling in general.

Say I start out building a blog engine

5条回答
  •  半阙折子戏
    2021-01-29 22:27

    Have you considered having the article controller essentially pass a message up / post an event? Then any "article-posted-event-listeners" would consume that message and respond accordingly; in your specific case, an email notifier would be listening for those events and be configured to do so. This way the article posting bits don't need to know anything about the email notifying bits.

提交回复
热议问题