aspnet/EntityFramework — pull request #1104 by ajcvickers (2014-11-19 23:19:17+00:00)
Title: Stop using DbContextConfiguration directly in most tests and remove from Context

This is part of Issue #641 which is about cleaning up the use of DbContextConfiguration. DbContextConfiguration is intended to help resolve dynamic services--that is, services for which the actual type/instance of service to use depends on the current context configuration. However, it has gradually spread throughout the code as a general purpose service locator. This causes dependencies to be hidden and creates a lot of coupling to DbContextConfiguration throughout the code, so I am making a set of changes to help fix this.

The previous changes removed most dependencies in the code on DbContextConfiguration. This meant that the tests were now using it only as an easy way to get a service provider setup with everything needed for an in-scope configured context instance. This change makes this more explicit both in the product code and in the tests that use it by removing the Configuration property from the context and replacing it instead with a hidden property for the scoped service provider. This explicitly exposes the fully setup scoped service locator which is very useful for testing and for writing extensions to the context that may require arbitrary services.

Also cleaned up a few remaining places where DbContextConfiguration was being used directly as a service locator--notably for the MigrationScaffolder and MigrationAssembly.