DDD-based. NET Development Framework-DDD Classic tiering

Source: Internet
Author: User
Tags app service unique id

The core idea of DDD is to control the solution from a database-centric approach to a domain model in the form of a business problem.

Here is a picture of me in the field-driven design and pattern combat book in the film, he fully interprets the classic hierarchy of DDD.

The reference relationship of the response is also in the program code

Each layer concept:

Presentation layer (Presentation layer): The user interface layer in the diagram includes the user interface layer, user input, and data presentation.

Application layer (Application layer): The application layer defines the business functions of the system and directs the domain objects in the domain layer to implement these functions.

Domain layer: The core layer that implements all business logic.

Infrastructure layer (Infrastructure layer): Provides the basic services for the entire business system.

cutting of domain models: domain-driven design in addition to a hierarchical description of the system architecture, it also makes clear responsibilities and strategies for objects (object)        : 1 , Entity (entities): has a unique ID, can be persisted, has the business logic, corresponds to the real world business object.         2 , Value object (Value objects): Does not have a unique ID, is described by an object's properties, typically a temporary object in memory, which can be used to pass parameters or to supplement the description of an entity.         3 , Factory (factories): mainly used to create entities, currently in the architecture practice, the IOC container is generally used to realize the function of the factory.         4 , Warehouses (repositories): a collection of entities to manage, encapsulating the persistence framework.         5, Service (services): for the superstructure to provide an operational interface, responsible for the domain object scheduling and encapsulation, while the external provision of various forms of service.

class dependencies at compile time for each layer (this is a very short dwarfish-poor diagram):

High-level modules should not rely on the underlying modules, both should be dependent on the abstract

Abstractions should not be dependent on detail, and detail should be dependent on abstraction.

ABP Detailed tiering:

What do we mean by looking up and down:

Presentation Layer

Presentation:

View Models (Javascript): =

Views (html/css): =

Localization, Navigation, Notifications: Multi-lingual, menu, notification

Web:

Web API Controllers:webapi Interface

MVC Controllers, Odata:odata is what I don't know

Application Layer (application)

Application services: App Service

DTOs: Data Transfer Object

DTO Mappers:automapper mapping between the entity and the DTO

Authorization: Parameter Validation

Session:

Audit Logging: Audit log

The application layer provides some application service (application services) methods for presentation layer invocation. An application service method receives a DTO (data transfer object) as an input parameter, performs a specific domain-level operation using this input parameter, and can return another dto as needed. In the presentation layer to the domain layer, the entity object should not be received or returned, and the DTO mapping should be done. An application service method is generally considered a unit of work. Validation of user input parameters should also be implemented at the application level. ABP provides an infrastructure that makes it easy to implement validation of input parameters. It is recommended to use a tool like AutoMapper to map the entity to the DTO.

Domain layer (domain Core)

Entities: Entities, domain objects, data and operations that represent the business domain

Value objects: Entity model

Repositories: warehousing, used to operate the database for data access. Warehousing interfaces are defined in the domain layer, and the implementation class for warehousing should be written on the infrastructure layer.

Domain Services: A domain service that should be written in the domain service method when the business rules that are processed span two (and more) entities.

Domain event: Domain events that can trigger domain events when certain situations occur in the domain layer, and capture and process them where appropriate.

Unit of work: working unit, a design pattern that maintains a list of business objects that have been modified (such as additions, deletions, and updates). It is responsible for coordinating the persistence of these business objects and concurrency issues.

Infrastructure (Infrastructure)

ORM (EntityFramework, NHibernate): ORM Framework, ABP provides EF and NHibernate support

DB Migrations:ef Code first creates a database with the

Background jobs: Job scheduling and automated tasks (similar to quartz.net)

Supplemental (single-page and multi-page applications)

In a single-page application (SPA), all resources are loaded to the client at once (or only core resources are loaded, lazy loading of other resources), and all subsequent and server interactions are invoked through Ajax. The HTML code is generated on the client side using the data received from the server. The entire page is not refreshed, and the view is only swapped in and out when necessary. There are many JavaScript spa frameworks, such as Angularjs,durandaljs,backbonejs and Emberjs. The ABP can use either of them, but it provides examples of using ANGULARJS and Durandaljs.

In a multi-page (classic) application (MPA), the client sends a request to the server, the server-side code (the ASP. NET MVC Controller) fetches the data from the database, and the Razor view engine generates the HTML code. These compiled pages are sent back to the client for display. Each new page will cause a refresh of the full page.

The spa and MPA involve a completely different architecture. For the backend management system, Spa is the best candidate, on the other hand, the blog is more suitable for the MPA model, because the blog is eager to be crawled by the search engine data. Although there are many tools to make the spa visible to search engines, the current general practice is to use MPA.

At last

The ABP balances some of the best frameworks or libraries, and in addition, ABP's own classes and systems provide a good infrastructure for building N-tier Web applications, as well as templates for creating layered solutions that can be used as a starting point for applications.

Based on the layering we have organized the project's class library with the solution folder:

Excerpt: 51459709

DDD-based. NET Development Framework-DDD Classic tiering

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.