Introduction

Layering of an application's codebase is a widely accepted technique to help reduce complexity and improve code reusability. To achieve layered architecture, ASP.NET Boilerplate follows the principles of Domain Driven Design.

分层应用程序的代码是一个被广泛接受的技术有助于降低复杂性和提高代码的可重用性。实现分层架构,ASP.NET样板如下领域驱动设计的原则。

Domain Driven Design Layers

There are four fundamental layers in Domain Driven Design (DDD):

  • Presentation Layer: Provides an interface to the user. Uses the Application Layer to achieve user interactions.
  • Application Layer: Mediates between the Presentation and Domain Layers. Orchestrates business objects to perform specific application tasks.
  • Domain Layer: Includes business objects and their rules. This is heart of the application.
  • Infrastructure Layer: Provides generic technical capabilities that support higher layers mostly using 3rd-party libraries.
  • 表示层:为用户提供一个接口。使用应用程序层实现用户交互。
    应用层:在表示层和域层之间进行中介。编排业务对象来执行特定的应用任务。
    域层:包含业务对象及其规则。这是应用程序的核心。
    基础架构层:提供一般技术支持高级层的功能,主要使用第三方库。

ASP.NET Boilerplate Application Architecture Model

In addition to DDD, there are also other logical and physical layers in a modern architected application. The model below is suggested and implemented for ASP.NET Boilerplate applications. ASP.NET Boilerplate not only makes to implement this model easier by providing base classes and services, but also provides startup templates to directly start with this model.

在国内也有在现代架构的应用逻辑层和物理层。建议和实施ASP.NET样板应用下面的模型。ASP.NET样板不仅使该模型的实现提供方便的基础类和服务,而且还提供了启动模板直接从这个模型。

Client Applications

These are remote clients uses the application as a service via HTTP APIs (API Controllers, OData Controllers, maybe GraphQL endpoint). A remote client can be a SPA, a mobile application or a 3rd-party consumer.Localization and Navigation can be done inside this applications.

这些都是远程客户使用应用程序通过HTTP API服务(API控制器、数据控制器,也许graphql端点)。远程客户机可以是spa、移动应用程序或第三方用户,本地化和导航可以在这个应用程序中完成。

Presentation Layer

ASP.NET [Core] MVC (Model-View-Controller) can be considered as the presentation layer. It can be a physical layer (uses application via HTTP APIs) or a logical layer (directly injects and uses application services). In either case it can include LocalizationNavigationObject MappingCachingConfiguration ManagementAudit Logging and so on. It should also deal with AuthorizationSessionFeatures (for multi-tenant applications) and Exception Handling.

Distributed Service Layer(分布式服务层)

This layer is used to serve application/domain functionality via remote APIs like REST, OData, GraphQL... They don't contain business logic but only translates HTTP requests to domain interactions or can use application services to delegate the operation. This layer generally include AuthorizationCachingAudit LoggingObject MappingException HandlingSession and so on...

这一层是用来为应用程序域通过远程API like rest,odata,GraphQL…它们不包含业务逻辑,但只将HTTP请求转换为域交互,或者可以使用应用程序服务来委托操作。此层通常包括授权、缓存、审计日志记录、对象映射、异常处理、会话等…

Application Layer

Application layer mainly includes Application Services those use domain layer and domain objects (Domain ServicesEntities...) to perform requested application functionalities. It uses Data Transfer Objects to get data from and to return data to presentation or distributed service layer. It can also deal with AuthorizationCachingAudit LoggingObject MappingSession and so on...

应用层主要包括使用域层和域对象(域服务、实体…)来执行请求的应用功能的应用服务。它使用数据传输对象从数据中获取数据,并将数据返回到表示或分布式服务层。它还可以处理授权、缓存、审计日志记录、对象映射、会话等等…

Domain Layer

This is the main layer that implements our domain logic. It includes EntitiesValue ObjectsDomain Services to perform business/domain logic. It can also include Specifications and trigger Domain Events. It defines Repository Interfaces to read and persist entities from data source (generally a DBMS).

这是实现我们域逻辑的主要层。它包括实体、值对象、域服务来执行业务/域逻辑。它还可以包含规范和触发域事件。它定义了从数据源(通常是DBMS)读取和保存实体的存储库接口。

Infrastructure Layer

Infrastructure layer makes other layers working: It implements repository interfaces (using Entity Framework Core for example) to actually work with a real database, it may include integration to a vendor to send emails and so on. This is not a strict layer below all layers, but actually supports other layers by implementing abstract concepts of them.

基础结构层使其他层发挥作用:它实现了存储库接口(例如使用实体框架核心)来实际工作数据库,它可以包括向供应商发送电子邮件等集成。这不是所有层之下的严格层,但是通过实现它们的抽象概念实际上支持其他层。

ABP框架系列之三十九:(NLayer-Architecture-多层架构)的更多相关文章

  1. ABP框架系列之三十四:(Multi-Tenancy-多租户)

    What Is Multi Tenancy? "Software Multitenancy refers to a software architecture in which a sing ...

  2. ABP框架系列之四十九:(Startup-Configuration-启动配置)

    ASP.NET Boilerplate provides an infrastructure and a model to configure it and modules on startup. A ...

  3. ABP框架系列之三十八:(NHibernate-Integration-NHibernate-集成)

    ASP.NET Boilerplate can work with any O/RM framework. It has built-in integration with NHibernate. T ...

  4. ABP框架系列之十九:(Debugging-调试)

    While it's not generally needed, you may want to step into ABP's source code while you debugging you ...

  5. ABP框架系列之三十二:(Logging-登录)

    Server Side(服务端) ASP.NET Boilerplate uses Castle Windsor's logging facility. It can work with differ ...

  6. ABP框架系列之三十五:(MVC-Controllers-MVC控制器)

    Introduction ASP.NET Boilerplate is integrated to ASP.NET MVC Controllers via Abp.Web.Mvc nuget pack ...

  7. ABP框架系列之三十六:(MVC-Views-MVC视图)

    Introduction ASP.NET Boilerplate is integrated to MVC Views via Abp.Web.Mvc nuget package. You can c ...

  8. ABP框架系列之三十:(Javascript-API-Javascript-API)

    ASP.NET Boilerplate provides a set of objects and functions that are used to make javascript develop ...

  9. ABP框架系列之五十四:(XSRF-CSRF-Protection-跨站请求伪造保护)

    Introduction "Cross-Site Request Forgery (CSRF) is a type of attack that occurs when a maliciou ...

随机推荐

  1. 英文文档帮查&翻译计划

    以CSDN为首,知乎其次,cnblog带路的一大批博客上充斥着大量低质量的编程入门教程,代码粗制滥造,毫无缩进,没有高亮,东抄西抄.初学者如果长期参照这种垃圾博客来解决问题,将会适得其反,走入歧途. ...

  2. 简单快捷使用Git

    1.简介和安装Git是世界上目前最先进的分布式版本控制系统.安装:https://git-for-windows.github.io下载.设置姓名和email:git config --global ...

  3. centos7 卸载 jdk

    ################ jdk 的安装 ###########################参考:https://www.cnblogs.com/Dylansuns/p/6974272.h ...

  4. HTML5-网页添加视频-菜鸟笔记

    一.标签 <video> 在html5中,有这么个标签 <video> 标签. <video> 允许你简单的嵌入一段视频. 二.浏览器的兼容性问题 WebM 容器通 ...

  5. java.util.HashSet, java.util.LinkedHashMap, java.util.IdentityHashMap 源码阅读 (JDK 1.8.0_111)

    一.java.util.HashSet 1.1 HashSet集成结构 1.2 java.util.HashSet属性 private transient HashMap<E,Object> ...

  6. ISNUMERIC使用说明和BUG

    ISNUMERIC ( expression )参数 expression 要计算的表达式.返回类型 int 备注当输入表达式的计算结果为有效的 numeric 数据类型时,ISNUMERIC 返回 ...

  7. C#//字节数组转16进制字符串

    //字节数组转16进制字符串 private static string byteToHexStr(byte[] bytes,int length) { string returnStr = &quo ...

  8. Java学习笔记(十二):java编译跨平台运行原理

    class文件由java源代码通过javac编译器编译生成,只能为JVM所识别.

  9. Pandas聚合

    数据聚合 import pandas as pd from pandas import Series import numpy as np # 准备数据 df = pd.DataFrame([[-0. ...

  10. 真机调试adb:wait for device 解决方案

    1.adb logcat 命令的时候,cmd总是提示adb server did't ACK.       分析一下,明显adb server没有开启成功,服务启动失败一般都是端口绑定失败,所以我们只 ...