ASP.NET Boilerplate project structure for new entities/services

architecture asp.net-core aspnetboilerplate ef-migrations entity-framework-core

Question

I have started to play around with ASP.NET Boilerplate framework. I want to keep my application-specific entities and services in two separate projects. This will keep the core framework project untouched.

However I am not sure if i have the entities in a separate project how will the migrations work. The module system in the documentation touches about the logic piece, but it does not talk about entities that are local to the module (so each module has its own entity that gets created when migrations take place).

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

1
0
5/1/2018 8:56:32 AM

Accepted Answer

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

Migrations work based on the DbSet that you define for each entity in DbContext.

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

So you can have the entities in a separate project.

  1. Add a dependency on YourSeparateCoreModule to *EntityFrameworkModule:

    [DependsOn(
        typeof(AbpProjectNameCoreModule), 
        typeof(YourSeparateCoreModule), // Add this
        typeof(AbpZeroCoreEntityFrameworkCoreModule))]
    public class AbpProjectNameEntityFrameworkModule : AbpModule
    
  2. Then add a DbSet for each of the entities.

3
5/1/2018 8:52:34 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow