Multi-tenancy and connection pool using EF 6

connection-pooling entity-framework entity-framework-6


We have developed a multi-tenant application using EF 4.3 Code First Model, where each tenant will have their own separate database. Since, we are expecting bit high number of tenants, we want to maintain the connection pool across tenants.

In order to achieve this in EF 4.3 Code First model, we have created 'AppMaster' database and developed own provider using EFProviderWrapperToolkit which internally uses the SQL provider only. Our customized provider will always first connects to 'AppMaster' database and then change the database to respective tenant specific database. Everything was working fine as expected.

But the same provider is not working with EF6 since they have moved the provider specific code to EntityFramework DLL under 'System.Data.Entity.Core.Common' namespace.

Any solution to maintain the connection pool across all tenants pointing to the respective database into the same database server?

5/3/2013 2:01:38 PM

Popular Answer

The provider model in EF6 has changed. First of all you need to use an EF6 provider. If you are using Sql Server the EF6 Sql Server provider is included in the EF6 package. Since the wrapping provider is just another provider you should read and follow the document about rebuilding a provider for EF6 and the wrapping provider should continue to work. Note that the document contains a section about wrapping providers in EF6. In addition in EF6 we introduced dependency injection and code-based configuration which makes some aspects of wrapping easier.

5/7/2013 4:50:32 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow