【问题标题】:How is code organized in the ABP framework?ABP 框架中的代码是如何组织的?
【发布时间】:2020-10-19 13:25:39
【问题描述】:

我对组织代码有一些疑问。我看到了两种组织代码的方式:package by layerpackage by componenthttp://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框架中哪种方法应用比较广泛?

【问题讨论】:

    标签: aspnetboilerplate


    【解决方案1】:

    ASP.NET Boilerplate 使用package by layer 或“领域驱动设计层”。
    https://aspnetboilerplate.com/Pages/Documents/NLayer-Architecture

    这是官方模板的文件夹结构,可在https://aspnetboilerplate.com/Templates下载,源代码托管在https://github.com/aspnetboilerplate/module-zero-core-template

    AbpCompanyName.AbpProjectName.sln
    src/
      AbpCompanyName.AbpProjectName.Application/
        Authorization/
        Configuration/
        MultiTenancy/
        Roles/
        Users/
      AbpCompanyName.AbpProjectName.Core/
        Authorization/
          Roles/
          Users/
        Configuration/
        MultiTenancy/
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-08
    • 1970-01-01
    • 2021-01-05
    • 2019-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多