Multi-tenancy and connection pool using EF 6

connection-pooling entity-framework entity-framework-6

Question

Using the EF 4.3 Code First Model, we have created a multi-tenant application where each tenant will have their own unique database. We want to maintain the connection pool across tenants because we anticipate a bit more tenants than usual.

We constructed the "AppMaster" database and built our own provider using the EFProviderWrapperToolkit, which internally uses the SQL provider exclusively, to accomplish this under the EF 4.3 Code First model. Our specialized provider will always establish a connection to the "AppMaster" database first before switching to the appropriate tenant-specific database. As expected, everything was operating smoothly.

However, because they migrated the provider-specific functionality to EntityFramework DLL under the "System.Data.Entity.Core.Common" namespace, the same provider does not function with EF6.

Is there a way to keep the connection pool between every tenant and the individual database on the same database server?

1
2
5/3/2013 2:01:38 PM

Popular Answer

In EF6, the provider model has changed. Use an EF6 provider first, of course. The EF6 package comes with the EF6 Sql Server provider if you're using SQL Server. You should read and abide by the guide for creating a new provider for EF6 since the wrapping provider is just another provider, and it should continue to do its job. The document includes a section on wrapping providers in EF6, so take note of it. Additionally, code-based configuration and dependency injection, which simplifies several parts of wrapping, was added in EF6.

0
5/7/2013 4:50:32 PM






Related

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