DDD and implementing persistence

后端 未结 3 571
猫巷女王i
猫巷女王i 2020-12-29 06:55

I am getting my feet wet with DDD (in .Net) for the first time, as I am re-architecting some core components of a legacy enterprise application.

Something I want to

3条回答
  •  不思量自难忘°
    2020-12-29 07:31

    Am I correct that the Repository Interfaces live within the Domain assembly, but the Repository Implementations exist within the persistence layer? The persistence layer contains a reference to the Domain layer, never vice versa?

    I disagree here, let's say a system is comprised of the following layers:

    • Presentation Layer (win forms, web forms, asp.net MVC, WPF, php, qt, java, , ios, android, etc.)
    • Business Layer (sometimes called managers or services, logic goes here)
    • Resource Access Layer (manually or ORM)
    • Resource/Storage (RDBMS, NoSQL, etc.)

    The assumption here is that the higher you are the more volatile the layer is (highest being presentation and lowest being resource/storage). It is because of this that you don't want the resource access layer referencing the business layer, it is the other way around! The business layer references the resource access layer, you call DOWN not UP!

    You put the interfaces/contracts in their own assembly instead, they have no purpose in the business layer at all.

提交回复
热议问题