With EF.DbContextFactory you can resolve easily your DbContext dependencies in a safe way injecting a factory instead of an instance itself, enabling you to work in multi-thread contexts with Entity Framework or just work safest with DbContext following the Microsoft recommendations about the DbContext lifetime.
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#L351The result is that I can now do this in my
Startup.cs
I don't know what you would like to do about Tests for this, as I didn't want to disrupt the existing setup.