Skip to content

Conversation

Meberem
Copy link

@Meberem Meberem commented Apr 9, 2020

AddAppDbContext in ef core has an overload allowing a developer to specify a "Service Type" and an "Implementation Type" for a DbContext. This allows you to have a base type in a Domain project and a particular implementation in a different project. This pull request is based on the ef core code here: https://github.com/dotnet/efcore/blob/c69926a8cdd05f4427e89ac8bac734e490b3d23a/src/EFCore/Extensions/EntityFrameworkServiceCollectionExtensions.cs#L351

The result is that I can now do this in my Startup.cs

services.AddDbContextFactory<AppDbContext, SqlServerAppDbContext>();

I don't know what you would like to do about Tests for this, as I didn't want to disrupt the existing setup.

@vany0114
Copy link
Owner

Hi @Meberem thanks for taking the time to do this! I've been very busy, so I'll try to take a look in the coming weeks, sorry about it.

@Meberem
Copy link
Author

Meberem commented Jul 21, 2020

Hey @vany0114, do you think you'll have a chance to look at this any time soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants