【发布时间】:2020-10-19 13:25:39
【问题描述】:
我对组织代码有一些疑问。我看到了两种组织代码的方式:package by layer 和 package by component。
http://www.codingthearchitecture.com/2015/03/08/package_by_component_and_architecturally_aligned_testing.html
ABP 框架本身并不要求采用特定的形式,而且似乎都支持这两种形式。
ABP框架给出的样例中只能看到package by layer。不清楚package by component能不能用。
例如,存在三个边界上下文:订单、产品和客户。
如果使用package by layer,如下图所示。
Project.sln
Project.Application
OrderContext
ProductContext
CustomerContext
Project.Core
OrderContext
ProductContext
CustomerContext
Project.EntityFrameworkCore
...
如果使用package by component,如下图所示。
Project.sln
hosts
Project.Host
modules
orders
Order.Application
Order.Core
Order.EntityFrameworkCore
products
Product.Application
Product.Core
Product.EntityFrameworkCore
customers
Customer.Application
Customer.Core
Customer.EntityFrameworkCore
ABP框架中哪种方法应用比较广泛?
【问题讨论】: