[Architect] ABP (modern ASP. NET Template Development Framework) (2) Layered architecture

Source: Internet
Author: User

This program records

    • Introduced
    • Domain Layer
    • Application Layer
    • Infrastructure Layer
    • Web Layer
      • SPA & MPA
      • Frameworks/libraries
    • Other

Introduced

In order to reduce complexity and improve the reusability of code, adopting a layered architecture is a widely accepted technique.

ABP follows domain driven Design, where there are 4 base tiers in DDD.

    • Presentation (presentation layer): Reference Application layer to provide a user interface.
    • Application (Application layer): acts as an intermediary between presentation and Domain layers. Coordinate business objects to perform special applications.
    • domain (domain layer): The core of the entire software, including business objects and rules.
    • Infrastructure: Provides technical support for other tiers. such as data persistence.

Layers that may be added:

    • Distributed Service (Distributed services layer): exposes the application layer and provides remote calls. such as the ASP. NET Web API and WCF implement this layer.

These are common hierarchies of domain-centric architectures that may be slightly different on the implementation.

Each layer can be implemented by one or more assemblies. It may be better to create multiple assemblies as third-party dependencies (such as NHibernate).

Domain (Core) Layer

This layer will implement all business rules.

Entities provides data and operations in the business area. Typically maps to a table in a database.

Repositories is a collection of 1 objects that can read and write entities from the database. Typically defined in the domain layer, implemented in the infrastructure layer.

Domain events defines a domain event and triggers and processes events. Domain Services handles entities and implement business rules to resolve features that are not part of a single entity.

Unit of work is a design pattern for 1 management entities that persist entities affected by business logic to the database.

This layer requires as few references as possible to third-party libraries.

Application Layer

The application layer contains the application services that the presentation layer needs to use.

The application service method accepts 1 DTOs (Data Transfer Object) as input parameters and uses this input parameter to perform some domain operations. Another 1 DTOs may be returned.

Typically, entities are not directly accepted and returned to the presentation layer.

Each service method will typically include, Unit of work. User Input Validation is implemented at this level.

ABP is easy to implement custom validation. and recommends using automapper as entity-to-DTOs conversion

Infrastructure Layer

The base class for the 2 ORM is provided in the infrastructure layer using the nhibernate or entityframework implementation of the domain layer definition REPOSITORIES,ABP.

Database migrations is recommended on this layer.

This layer generally provides dependent third-party libraries for other tiers.

Web & Presentation LayersSPA & MPA

The web layer can be implemented using the ASP. NET MVC and Web API, which can be implemented as multi-page applications or single-page applications.

In single-page application (SPA) , all resources are loaded (or lazy-loaded) to the client, and then the server is invoked through AJAX. The server returns the data to the client, and the client generates the HTML. The page does not refresh.

There are many JS spa frameworks, such as AngularJs, Durandaljs, Backbonejs, and Emberjs. The ABP can be arbitrarily combined and provides an example of Angularjs and Durandaljs.

In multi-page (Classic) application (MPA), the client sends 1 requests to the server side, the server obtains the data from the database, generates the HTML through razor views, returns to the client display, Each new page will cause the entire refresh.

Spa and MPA involves the completion of different architectures, background management for the use of the spa architecture, blogs for the MPA architecture, because blogs want to be crawled by search engines, although some tools can make Spas visible to search engines, generally still use MPa

Frameworks/libraries

SIGNALR is a great tool for server push notifications that provides a rich, timely user experience.

There are many JavaScript libraries & Frameworks,jquery are the most popular and have many free plugins.

There are also many HTML & CSS Tools/frameworks,twitter bootstrap currently very hot.

The ABP provides the infrastructure that automatically creates the Web API for the application service, and it is easy to invoke it via JS (see documentation).

ABP also provides the infrastructure for menus, localization localization, language switching, JS display system messages and notifications.

The ABP automatically handles exceptions and returns the appropriate results to the client.

Other

ABP provides and uses Castle Windsor as Dependency injection.

At the same time, log4net for logging is used on the server. And it's easy to switch logs without changing the code

ABP uses very good frameworks/libraries and provides a complete infrastructure, while providing templates convenience to start 1 new projects.

[Architect] ABP (modern ASP. NET Template Development Framework) (2) 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.