ASP.NET 新 entities/services 的样板项目结构

ASP.NET Boilerplate project structure for new entities/services

我已经开始使用 ASP.NET 样板框架。我想将特定于应用程序的实体和服务保留在两个单独的项目中。这将使核心框架项目保持不变。

但是我不确定我是否在单独的项目中有这些实体,迁移将如何工作。文档中的模块系统涉及逻辑部分,但不涉及模块本地的实体(因此每个模块都有自己的实体,在迁移发生时创建)。

如果我们需要将我们的实体和服务分离到各个项目,我们有什么选择?

However I am not sure if i have the entities in a separate project how will the migrations work.

迁移基于您为 DbContext 中的每个实体定义的 DbSet

What options do we have if we need to separate our entities and services to individual projects?

因此您可以将实体放在单独的项目中。

  1. 添加对YourSeparateCoreModule的依赖到*EntityFrameworkModule:

    [DependsOn(
        typeof(AbpProjectNameCoreModule), 
        typeof(YourSeparateCoreModule), // Add this
        typeof(AbpZeroCoreEntityFrameworkCoreModule))]
    public class AbpProjectNameEntityFrameworkModule : AbpModule
    
  2. 然后为每个实体添加一个DbSet