Using ABP 0.12 across the board, I have 1 master solution containing the core projects (EF,App,Core,Web,WebApi). In addition I have several 'Module' projects (each on their own with their own EF,App,Core). Each module project has a base repo/ef configuration to allow them to manage their own tables. I have 2 modules right now. When I tell the Web module to load the second module as a dependancy, it throws the error 'Multiple Concrete DBContext defined'
The way I have it laid out is as so
Master -> MainDbContext (Abstract) (No Repo's/Tables) Core -> CoreDbContext (Public / non abstract / inherits MainDbContext) (Contains all core tables + ABP+Zero Tables) Module 1 -> Module1DbContext (Public / Non-abstract / Inherits MainDbContext) (Contains only Module 1 tables) Module 2- > Module2DbContext (Public / Non-Abstract / Inherits MainDbContext) (Contains only Module 2 tables)
Master & Core are in the same EF project, the other modules link to that EF project to get the Master context and build.
The odd thing, maybe not so odd. Is that everything works when I disable one of the modules. Each module is referenced identically.
Thanks for any help,
amwdrizz
5 Answer(s)
-
0
Hi,
Can you try to add [DefaultDbContext] attribute to your CoreDbContext ?
-
0
I have tried adding DefaultDbContext to the CoreDBContext class, no change in operation. In fact that is the only thing that permits Core + Module to function. I apologize if I wasn't clear about that.
My current solution was to do the following.
Create generic role builder under core. Reference the core ef project from the modules. Then call the generic role builder from each module. This allowed me to drop the AbpZeroDBContext requirement from the sub-modules. Once I did that, the app launched with out error.
Still testing to ensure nothing else broke in the process, but it looks promising.
-
0
Hi,
First of all, your configuration seems a bit complext but fine. We need a bit more information to solve your problem. Can you check text logs to share exact exception message and stacktrace.
-
0
Here is a Gist of the stack trace [https://gist.github.com/amwdrizz/73bb6abb62f29bec404c96f10812fd0e])
-
0
Hi,
If you add [DefaultDbContext] attribute to ONE OF THE following dbcontexes, then it will work:
- OnyxeyeDbContext
- ImportDbContext
- InventoryDbContext
This error occurres because you request a repository of an entity but given entity is included in more than one dbcontext and ABP can not know which one to use.