. NET Logical Layered Architecture Demo: The evolution of the DDD layered architecture

Source: Internet
Author: User
Tags to domain

Overview:   If the design is flawed at the architectural level, the solution is either farfetched or incomprehensible. It is difficult for a solution to apply DDD if it is built with a solution that relies on the inability to match the schema diagram and introduces too many dependencies. Architecture is a high-level design, if the design and understanding is wrong, will inevitably bring a variety of problems in the implementation. The architecture is the most stable and will not be affected by the dependence of specific technologies, such as various UI frameworks, ORM frameworks, and the upgrading of the IOC framework. The above summary does not have any demo because the architecture is more design-level, there are people from the Design view to create a solution experience, see what I am talking about. This article will show you from the schema Design view to the. NET multi-project solution. This includes the following: (1) demonstrates the mapping of a DDD tiered schema to a. NET Multi-project solution. (2) demonstrates that the DDD hierarchy relies on mappings to. NET project references. (3) demonstrate dependency injection in. NET multi-project solution. This article originates from: http://www.cnblogs.com/easygame/ first, the original DDD layering   1. Architecture Diagram 2. Build a solutionCreate a new blank solution and add the following items: (1) Ddd.domain Class Library project. (2) Ddd.application Class Library project. (3) Ddd.infrastructure Class Library project. (4) DDD.UI.MVC ASP. NET Empty project, select MVC Reference. (5) Ddd.repository Class Library project. 3. to set up a reference relationship between projects:(1) DDD.UI.MVC add Ddd.application, DDD. Domain, DDD. References to infrastructure and ddd.repository. (2) Add Ddd.domain, DDD to Ddd.application. Infrastructure reference. (3) Add a ddd.infrastructure reference to Ddd.domain. (4) Add Ddd.domain and ddd.infrastructure references to the repository project. 4. Using Dependency Injection: for more complete decoupling, we do not rely on any specific IOC framework and its kind and version, even if we apply the dependency inversion principle to the implementation of dependency injection. The interface is implemented in the infrastructure layer using 2 different IOC frameworks, and is shown in use by direct injection and by reflection in two ways. Reflection enables the implementation of IOC to rely on the use of configuration file management. (1) IOC Abstract Interface (2) management Class (3) Managing Dependency Injection 5. Code Map and Solution view: Code map naked tells us that the three words "disharmony": (1) looks more like the infrastructure layer as the core. (2) Repository cannot be placed on the infrastructure layer, even if you change its namespace to DDD.Infrastructure.Repository. (3) The field layer is externally dependent. (4) See the schema diagram who can correspond to this code map? Demo1 Download: Click to download second, improve the DDD stratification   1. Architecture Diagram
2. Build a solutionCreate a new blank solution and add the following items: (1) Ddd.domain Class Library project. (2) Ddd.application Class Library project. (3) Ddd.infrastructure Class Library project. (4) DDD.UI.MVC ASP. NET Empty project, select MVC Reference. 3. to set up a reference relationship between projects:(1) DDD.UI.MVC add Ddd.application, DDD. A reference to domain and ddd.infrastructure. (2) Add Ddd.domain, DDD to Ddd.application. Infrastructure reference.  (3) Add a ddd.domain reference to Ddd.infrastructure. 4. Improvement:(1) The ientity and IRepository interfaces are defined at the domain level, and the domain layer is no longer dependent on the infrastructure layer. (2) Repository is truly implemented at the infrastructure level. 5. Code Map and Solution view:It looks great: (1) perfectly matched to the architecture diagram. (2) The domain layer is the center. (3) no longer need to add unnecessary code to the service layer for the infrastructure layer to be unable to reference the domain layer. Demo2 Download: Click to download third, the latest DDD layering 1. Architecture Diagram 2. Build solutions: Ibid.   3. to set up a reference relationship between projects:(1) DDD.UI.MVC add Ddd.application, DDD. A reference to domain and ddd.infrastructure. (2) Add a ddd.domain reference to ddd.application. (3) Add ddd.application and Ddd.domain references to ddd.infrastructure. 4. Improvement:(1) The IService interface is defined at the application layer. (2) Further define all dependent interfaces in the domain layer and application layer, including dependency injection management. 5. Code Map and Solution view:Better understanding and use: (1) at the architectural level, at the core of the domain, the other technology relies on a level of implementation, write code no longer have to worry about not knowing where to write. (2) Throwing domain logic and application logic to the application and domain layers, all dependencies are thrown into the implementation layer, and the frame composition is the solution view. (3) in three kinds of solutions, rely on the least, the direction is consistent, the most easy to understand and use.   Demo3 Download: Click to download Reference1. Patterns of Enterprise application Architecture"Enterprise Application Architecture Mode" 2. Domain-driven Design"Domain driven Design: The core complexity of software" 3. applying Domain-driven Design and Patterns"Field-driven design and pattern combat" 4. Implementing Domain-driven Design"Implementing Domain Driven Design" 5. Microsoft Application Architecture Guide"Microsoft Application Architecture Guide (2nd edition)" 6. Professional Enterprise. NETProficient in. NET Enterprise Project development: The latest models, tools and methods "7. Professional ASP. NET Design Patterns"ASP. NET design pattern "

. NET Logical Layered Architecture Demo: The evolution of the DDD layered architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.