ABP框架系列之三十九:(NLayer-Architecture-多层架构)
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 Localization, Navigation, Object Mapping, Caching, Configuration Management, Audit Logging and so on. It should also deal with Authorization, Session, Features (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 Authorization, Caching, Audit Logging, Object Mapping, Exception Handling, Session 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 Services, Entities...) 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 Authorization, Caching, Audit Logging, Object Mapping, Session and so on...
应用层主要包括使用域层和域对象(域服务、实体…)来执行请求的应用功能的应用服务。它使用数据传输对象从数据中获取数据,并将数据返回到表示或分布式服务层。它还可以处理授权、缓存、审计日志记录、对象映射、会话等等…
Domain Layer
This is the main layer that implements our domain logic. It includes Entities, Value Objects, Domain 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-多层架构)的更多相关文章
- ABP框架系列之三十四:(Multi-Tenancy-多租户)
What Is Multi Tenancy? "Software Multitenancy refers to a software architecture in which a sing ...
- ABP框架系列之四十九:(Startup-Configuration-启动配置)
ASP.NET Boilerplate provides an infrastructure and a model to configure it and modules on startup. A ...
- ABP框架系列之三十八:(NHibernate-Integration-NHibernate-集成)
ASP.NET Boilerplate can work with any O/RM framework. It has built-in integration with NHibernate. T ...
- ABP框架系列之十九:(Debugging-调试)
While it's not generally needed, you may want to step into ABP's source code while you debugging you ...
- ABP框架系列之三十二:(Logging-登录)
Server Side(服务端) ASP.NET Boilerplate uses Castle Windsor's logging facility. It can work with differ ...
- ABP框架系列之三十五:(MVC-Controllers-MVC控制器)
Introduction ASP.NET Boilerplate is integrated to ASP.NET MVC Controllers via Abp.Web.Mvc nuget pack ...
- ABP框架系列之三十六:(MVC-Views-MVC视图)
Introduction ASP.NET Boilerplate is integrated to MVC Views via Abp.Web.Mvc nuget package. You can c ...
- ABP框架系列之三十:(Javascript-API-Javascript-API)
ASP.NET Boilerplate provides a set of objects and functions that are used to make javascript develop ...
- ABP框架系列之五十四:(XSRF-CSRF-Protection-跨站请求伪造保护)
Introduction "Cross-Site Request Forgery (CSRF) is a type of attack that occurs when a maliciou ...
随机推荐
- C#使用ITextSharp操作pdf
在.NET中没有很好操作pdf的类库,如果你需要对pdf进行编辑,加密,模板打印等等都可以选择使用ITextSharp来实现. 第一步:可以点击这里下载,新版本的插件升级和之前对比主要做了这几项重大改 ...
- android 开发 框架系列 使用 FileDownloader 实现检查更新的功能class
首先介绍一下FileDownloader GH :https://github.com/lingochamp/FileDownloader/blob/master/README-zh.md FileD ...
- FTP管理常用命令
#新增用户liuhui,指定群组为groupa,附加群组为groupb,家目录为/ftp/groupbuseradd -g groupa -G groupb -d /ftp/groupb linhui ...
- Spring中Bean及@Bean的理解
Spring中Bean及@Bean的理解 Bean在Spring和SpringMVC中无所不在,将这个概念内化很重要,下面分享一下我的想法: 一.Bean是啥 1.Java面向对象,对象有方法和属性, ...
- ARM中R0-R15寄存器的作用
根据“ARM-thumb 过程调用标准”: 注意:在中断程序中,所有的寄存器都必须保护,编译器会自动保护R4-R11
- try、catch、finally都有return语句时执行哪个
任何执行try 或者catch中的return语句之前,都会先执行finally语句,如果finally存在的话.如果finally中有return语句,那么程序就return了,所以finally中 ...
- 工程C++基础
大家好,我是老A.今天我们要学习的是工程C++,这是一个不可描述的东西.我主要讲的是template. template的用处是装逼,所以很重要. C++配备了函数模板和类模板.函数模板就是我们平时的 ...
- 1.Ansible安装以及配置
本节内容以Centos7为系统环境进行讲解: 1.安装epel源,方便直接yum安装: wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun ...
- Linux网络编程学习(五) ----- 信号(第四章)
1.基本概念 进程阻塞: 进程执行条件得不到满足,就自动放弃CPU资源而进入休眠状态,以等待条件满足,当条件满足时,系统就将控制权还给该进程进行未完成的操作 共享资源: 进程间协调使用的系统资源 锁定 ...
- vue.js简单添加和删除
这只是个简单的添加和删除,没有连接后台数据的 <%@ page language="java" contentType="text/html; charset=UT ...