[Feature Request] Multiple DbContext Support
See original GitHub issueRecently, I ran into a requirement of referencing multiple databases in a single project.
Latest version of EFCorePowerTools
can generate multiple DatabaseContexts
, but overrides the configuration in efpt.config.json
with the last used DatabaseContext
.
Is there any plan on supporting configuration for multiple datacontexts
in the efpt.config.json
?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:20 (16 by maintainers)
Top Results From Across the Web
Entity Framework: One Database, Multiple DbContexts. Is ...
You can have multiple contexts for single database. It can be useful for example if your database contains multiple database schemas and you ......
Read more >Why is it suggested to have on DbContext instance per ...
It will be bad to create one global Entity Framework DbContext in a web application, because the DbContext class is not thread-safe. In...
Read more >How do i handle multiple DbContexts with relations to each ...
I'm currently working on my semester project that is based on ASP.NET Core MVC. We've been introduced to EntityFrameworkCore and generally i ...
Read more >How to Get multiple database DBContext service in .net ...
Hello Coders, I want to know how to connect with multiple databases in web application in .net core MVC 3.1 dynamically as per...
Read more >Best Practices in Using the DbContext in EF Core
If you need multiple database connections or have multiple active contexts operating in parallel, then use the DbContextFactory class ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@theprateik @LouisGordon @aetos382 @blogcraft
The latest daily build allows you to use multiple efpt.config.json files in the same project - https://github.com/ErikEJ/EFCorePowerTools/wiki/Reverse-Engineering#saving-options-and-running-the-second-time
Thanks for the response, sorry for my late reply. We have backed away from ef core at the moment but I could have considered the approach of keeping the contexts in different libraries, though I had a single project that would need to reference both. We’re on a multi tenant platform where a number of years ago decisions were made to segregate certain pieces of data, likely with pretty good reasons.