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 ...
随机推荐
- java多线程中并发集合和同步集合有哪些?区别是什么?
java多线程中并发集合和同步集合有哪些? hashmap 是非同步的,故在多线程中是线程不安全的,不过也可以使用 同步类来进行包装: 包装类Collections.synchronizedMap() ...
- k8s学习笔记之三:k8s快速入门
一.前言 kubectl是apiserver的客户端工具,工作在命令行下,能够连接apiserver上实现各种增删改查等各种操作 kubectl官方使用文档:https://kubernetes.io ...
- 深入理解Servlet原理
Servlet介绍: 1. 如何返回一个网页: a. 静态网页 >新闻页.百度百科 >服务器保存一份HTML,直接返回给浏览器即可 b. 动态网页 >淘宝.QQ空间.微博 >服 ...
- Android 开发 Handler的基本使用
转载请注明出处:http://blog.csdn.net/vnanyesheshou/article/details/72677227 深入理解Handler.Looper.Messagequeue ...
- !!学习笔记:CSS3动画
一句话就有css3动画: 2016-6-29 <style type="text/css"> h1{background:#999;} h1:hover{border- ...
- springboot发送邮件
1.在发送端邮箱平台开通SMTP服务 1)以163邮箱为例: step 1: step 2: 2.编写代码: 1)添加发送邮箱maven依赖 <dependency> <groupI ...
- suse linux安装lrzsz
1.从下面的网站下载 lrzsz-1.12.20.tar.gz http://www.filewatcher.com/m/lrzsz-0.12.20.tar.gz.280938.0.0.html 2. ...
- angular中使用ckplayer播放器
原文地址:https://www.cnblogs.com/jying/p/9519557.html ,转载请说明出处. ckplayer官网:http://www.ckplayer.com 使用ckp ...
- html转换pdf
项目需求:移动端APP项目需要在手机上签订合同,将html转换成pdf格式的文件 解决方案:是用插件wkhtmltopdf; 记录用法:1.网址https://wkhtmltopdf.org/ 下载压 ...
- 常用curl命令
curl -F "userfile=@/Users/username/Downloads/20170502.zip" http://youip/up.php curl -X POS ...