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 ...
随机推荐
- Linux的命令技巧
一.使用apt-get installl 方法安装的库或者程序一般的路径如下 1.下载的软件存放位置 /var/cache/apt/archives 2.安装后软件默认位置 /usr ...
- WPF 去掉Drag a column header here to group by that column
<dxg:GridControl.View> <dxg:TableView x:Name="view" ShowGroupPanel="False&qu ...
- ORA-03137: TTC 协议内部错误: [12333] [4] [49] [51] [] [] [] []
[1]问题背景:Oracle数据库版本为11.2.0.1,操作系统CentOS release 5.9,详细的报错信息如下: Dump file /data/oracle/diag/rdbms/db0 ...
- Android 开发 AlarmManager 定时器
介绍 AlarmManager是Android中常用的一种系统级别的提示服务,在特定的时刻为我们广播一个指定的Intent.简单的说就是我们设定一个时间,然后在该时间到来时,AlarmManager为 ...
- SQLite在Android程序中的使用方法,SQLite的增删查改方法
Sqlite: 1.一款用来实现本地数据存储的轻量级数据管理工具,是众多用来实现数据库管理的工具之一. 2.Android已经将SQLite的代码功能吸收在它的系统中,我们可以直接在Android程序 ...
- ReactiveX 学习笔记(21)使用 Rx.NET + ReactiveUI 进行 GUI 编程
课题 程序界面由3个文本编辑框和1个文本标签组成. 要求文本标签实时显示3个文本编辑框所输入的数字之和. 文本编辑框输入的不是合法数字时,将其值视为0. 3个文本编辑框的初值分别为1,2,3. 创建工 ...
- 高性能迷你React框架anujs1.1.0发布
本版本对setState与forceUpdate内部依赖的setStateImpl进行了重构,性能稳定在60pfs之上.并且将组件实例的所有内部方法与属性都改成以___开头. https://gith ...
- tfs填坑那些事
1.csdn下载 安装(步1:装 步2:激活 步3:配置数据库之类 选择完全配置)激活(win7能出来,win10不出来) 注意 tfs服务开启,,代理服务开启 2.选择敏捷模板 3.无法新建项目, ...
- Linux jdk安装
Linux上一般会安装Open JDK,关于OpenJDK和JDK的区别:http://www.cnblogs.com/sxdcgaq8080/p/7487369.html 下面开始安装步骤: --- ...
- cdnbest如何让用户访问走最近最快的线路(分组线路)
用户访问网站有时网络有互通的问题,cdnbest的分组解析可以细分线路,让用户访问自动走最优线路,线路不细分都加默认里,访问的节点是随机分配的 下面我们讲下如何设置: 比如你有电信,移动,和国外的节点 ...