What is a practical way to model lookup tables in Domain Driven Design (DDD)?

前端 未结 5 2043
青春惊慌失措
青春惊慌失措 2021-01-30 07:02

I\'m just learning DDD (Eric Evans book is open in front of me) and I\'ve come across a problem that I can\'t find an answer for. What do you do in DDD when you\'re just trying

5条回答
  •  走了就别回头了
    2021-01-30 07:31

    You're reading the wrong book if you want to learn how to do DDD without over complicating it. :-)

    The simplest solution you're proposing is fine if it meets your needs. Encapsulating address data in business objects can be as simple or as complicated as your application demands. For example, the State object has a one-to-many relationship with County so Employee really just needs to reference a County if you chose to model it that way. I would only introduce that sort of complexity if required.

    Additionally, I don't think there's much to be gained by defining interfaces for your repositories unless there's a real possibility that you might have multiple repositories for your objects.

提交回复
热议问题