If the SQL Server provider is registered in the config file, then it will register secondary default resolvers for the following services:
- IDbConnectionFactory
- IDbExecutionStrategy
- MigrationSqlGenerator
- DbSpatailServices
This is correct and as expected. The problem is that if SQL Server is not registered in the config file then it is still registered by EF by convention if the assembly is available. This means that if you have another provider regsitered using code-base configuration, then it will not get a chance to change the default services for any of the types above. What should happen is that any explicitly registered provider should take precedence over the by-convention registered SQL Server provider.
There are three workarounds:
- Register the provider in the config file--this is the normal path anyway
- Register the services in code as normal resolvers instead of default resolvers
- Remove the SQL Server assembly so that it is not registered by default
- IDbConnectionFactory
- IDbExecutionStrategy
- MigrationSqlGenerator
- DbSpatailServices
This is correct and as expected. The problem is that if SQL Server is not registered in the config file then it is still registered by EF by convention if the assembly is available. This means that if you have another provider regsitered using code-base configuration, then it will not get a chance to change the default services for any of the types above. What should happen is that any explicitly registered provider should take precedence over the by-convention registered SQL Server provider.
There are three workarounds:
- Register the provider in the config file--this is the normal path anyway
- Register the services in code as normal resolvers instead of default resolvers
- Remove the SQL Server assembly so that it is not registered by default