3.2 Dependencies of the Projects in the Solution 解决方案中项目间的依赖项
3.2 Dependencies of the Projects in the Solution 解决方案中项目间的依赖项
The diagram below shows the essential dependencies (project references) between the projects in the solution (IssueTracking.part is not shown to be simple)
解决方案中各项目之间的基本依赖关系(项目引用关系)(为了简化IssueTracking.部分没有显示):

The projects have been explained before. Now, we can explain the reasons of the dependencies;
前面我们已经解释过这些项目。现在,我们可以解释这些依赖项的原因。
- Domain.Shared is the project that all other projects directly or indirectly depend on. So, all the types in this project are available to all projects.
- Domain.Shared是所有其他项目直接或间接依赖的项目。所以,这个项目中的所有类型对所有项目都可用。
- Domain only depends on the
Domain.Sharedbecause it is already a (shared) part of the domain. For example, anIssueTypeenum in theDomain.Sharedcan be used by an Issue entity in the Domain project. - Domain只依赖于
Domain.Shared,因为它已经是Domain的一个(共享)部分。例如,Domain.Shared中的枚举类型IssueType可以被Domain项目中的Issue实体使用。 - Application.Contracts depends on the
Domain.Shared. In this way, you can reuse these types in the DTOs. For example, the sameIssueTypeenum in theDomain.Sharedcan be used by aCreateIssueDtoas a property. - Application.Contracts依赖于
Domain.Shared。通过这种方式,你可以在DTO中重用这些类型。例如,Domain.Shared中的同一个IssueType枚举可以被CreateIssueDto作为一个属性使用。 - Application depends on the
Application.Contractssince it implements the Application Service interfaces and uses the DTOs inside it. It also depends on theDomainsince the Application Services are implemented using the Domain Objects defined inside it. - Application依赖于
Application.Contracts,因为它实现了应用服务接口并使用其中的DTO。它也依赖于Domain,因为应用层服务是通过它里面定义的Domain对象实现的。 - EntityFrameworkCore depends on the
Domainsince it maps the Domain Objects (entities and value types) to database tables (as it is an ORM) and implements the repository interfaces defined in theDomain. - EntityFrameworkCore依赖于
Domain,因为它将领域对象(实体和值类型)映射到数据库表(因为它是一个ORM)并实现Domain中定义的存储库接口。 - HttpApi depends on the
Application.Contractssince the Controllers inside it inject and use the Application Service interfaces as explained before. - HttpApi依赖于
Application.Contracts,因为它里面的控制器注入并使用应用服务接口,前面已解释说明过。 - HttpApi.Client depends on the
Application.Contractssince it can consume the Application Services as explained before. - HttpApi.Client依赖于
Application.Contracts,因为它可以使用应用服务,前面已解释说明过。 - Web depends on the
HttpApisince it serves the HTTP APIs defined inside it. Also, in this way, it indirectly depends on theApplication.Contractsproject to consume the Application Services in the Pages/Components. - Web依赖于
HttpApi,因为它提供了在它里面定义的HTTP APIs。另外,通过这种方式,它间接地依赖于Application.Contracts项目运用于页面/组件中的应用服务。
Dashed Dependencies 隐含的依赖项
When you investigate the solution, you will see two more dependencies shown with the dashed lines in the figure above. Web project depends on the Application and EntityFrameworkCore projects which theoretically should not be like that but actually it is.
当你调查这个解决方案时,你会看到还有两个依赖关系,在上图中用虚线表示。Web项目依赖于Application项目和EntityFrameworkCore项目,理论上不应该是这样,但实际上是这样。
This is because the Web is the final project that runs and hosts the application and the application needs the implementations of the Application Services and the Repositories while running.
这是因为 Web项目是运行和托管应用程序的最终项目,应用程序在运行时需要应用服务和存储库的实现。
This design decision potentially allows you to use Entities and EF Core objects in the Presentation Layer which should be strictly avoided. However, we find the alternative designs over complicated. Here, two of the alternatives if you want to remove this dependency;
这个设计决定有可能让你在表现层中使用实体和EF核心对象,这应该是不允许的。然而,我们发现替代设计过于复杂。在这里,如果你想消除这种依赖关系,有两个备选方案:
- Convert Web project to a razor class library and create a new project, like Web.Host, that depends on the Web,Application and EntityFrameworkCore projects and hosts the application. You don't write any UI code here, but use only for hosting.
- 将
Web项目转换为Razor类库,并创建一个新的项目,如Web.Host,它依赖于Web,Application和EntityFrameworkCore项目并托管这个应用程序。你不在这里写任何UI代码,而只用于托管。 - Remove
ApplicationandEntityFrameworkCoredependencies from theWebproject and load their assemblies on application initialization. You can use ABP's Plug-In Modules system for that purpose. - 从
Web项目中移除Application和EntityFrameworkCore依赖,并在应用程序初始化时加载它们的程序集。你可以使用ABP的插件模块系统达到此目的。
3.2 Dependencies of the Projects in the Solution 解决方案中项目间的依赖项的更多相关文章
- Visual Studio Many Projects in One Solution VS中多工程开发
在用VS开发项目的时候,我们可以将不同的模块拆分开来,分别建立单独的Project来开发调试,整个放到一个Solution中就行了.这样做的好处是结构清晰,每个功能模块可以单独调试,而不用编译整个So ...
- Shortcut Collapse project or projects in the Solution Explorer Microsoft Visual Studio 2008
The standard windows keyboard shortcuts for expanding and collapsing treeviews are: Numeric Keypad * ...
- Gradle依赖项学习总结,dependencies、transitive、force、exclude的使用与依赖冲突解决
http://www.paincker.com/gradle-dependencies https://docs.gradle.org/current/userguide/dependency_man ...
- 3: 组件间的依赖管理 Managing Dependencies Between Components Using the Prism Library 5.0 for WPF(英汉对照版)
Applications based on the Prism Library are composite applications that potentially consist of many ...
- java组件不存在解决方案:右侧Maven Projects展开后左上角第一个刷新按钮 刷新后就会从新加载所有java的依赖项了
java组件不存在解决方案:右侧Maven Projects展开后左上角第一个刷新按钮 刷新后就会从新加载所有java的依赖项了 软件:idea 问题产生:其他同事进行开发,引入新java组件后提交 ...
- Maven问题总结:Eclipse中项目右键菜单中点击Maven->Update Projects时JDK被重置
Eclipse中在项目右键菜单点击->Maven->Update Projects时,JDK总是切回 1.5 如果没有在Maven中配置过JDK版本,只是在Eclipse中项目的Prope ...
- The POM for XXX is invalid, transitive dependencies (if any) will not be available解决方案
今天,某个开发的环境在编译的时候提示警告The POM for XXX is invalid, transitive dependencies (if any) will not be availab ...
- dependencies与devDependencies中应该放哪些依赖
网上一般的解释都是,开发环境用devDependencies,生产环境用dependencies,说的很简明,但是这里有个问题是,哪些包需要放到devDependencies中,哪些包需要放到depe ...
- SharePoint2016母版页的直接依赖项的数目限制超过10的限制解决方案Direct Dependencies Limit with Master page User Controls
前言 最近母版制作站点模板,根据站点模板新建后发现如下错误: 解决方案 1. 打开C:\inetpub\wwwroot\wss\VirtualDirectories\,如下图: 2. 打开web.co ...
随机推荐
- (一)羽夏看C语言——简述
"羽夏看C语言"介绍什么 本系列从汇编的角度,比较翔实的介绍C语言.C++和C其实是一样的东西,C++的编译器只是更强大,更能帮助我们写代码,例如模板.没有特殊说明,本系列不会 ...
- AtomicStampedReference AtomicReference解决CAS机制中ABA问题
AtomicStampedReference AtomicReference解决CAS机制中ABA问题 AtomicStampedReference AtomicStampedReference它内部 ...
- APT组织跟踪与溯源
前言 在攻防演练中,高质量的蓝队报告往往需要溯源到攻击团队.国内黑产犯罪团伙.国外APT攻击. 红队现阶段对自己的信息保护的往往较好,根据以往溯源成功案例来看还是通过前端js获取用户ID信息.mysq ...
- Redis集群的搭建及与SpringBoot的整合
1.概述 之前聊了Redis的哨兵模式,哨兵模式解决了读的并发问题,也解决了Master节点单点的问题. 但随着系统越来越庞大,缓存的数据越来越多,服务器的内存容量又成了问题,需要水平扩容,此时哨兵模 ...
- uniapp获取用户OpenId及用户详情
页面增加一个按钮 <button type="default" open-type="getUserInfo" @click="getUserI ...
- 痞子衡嵌入式:原来i.MXRT1xxx系列里也暗藏了Product ID寄存器
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MXRT1xxx系列里暗藏的Product ID寄存器. MCU 厂商在定义一个产品系列时,通常是会预先规划产品发展路线的(即会有一 ...
- 远程桌面连接(mstsc)全攻略
打算从今天开始,写一写我经常用的,有长时间使用经验的东西,与大家分享,就从mstsc开始吧! mstsc应该是在Windows中,除了calc.cmd.notepad.mspaint,我使用率最高的系 ...
- 解决vscode可以编译通过c++项目,但头文件有红色波浪线的问题
解决vscode可以编译通过c++项目,但头文件有红色波浪线的问题 一.问题描述 我是在Ubuntu 16.04的环境下,用vscode写代码的,一般不使用vscode自带的编译环境,而是用cmake ...
- 做一个U盘的学习路线
最近想研究一个U盘,然后顺便熟悉一下USB协议.因为USB协议比较复杂, 常用的复杂外设除了WiFi,Ethernet,SDIO和USB这些就是USB了,学习USB的时候肯定要拿一个东西下手,所以简单 ...
- supermvc 操作备要
模板暂时仅支持smarty,需要指定模板文件 系统配置文件在supermvc文件夹下 sconfig.php 修改项目目录下的conf下的config.php 会覆盖系统默认配置 contro ...