Albert7dc
Albert7dc

Reputation: 11

Reuse an open EntityConnection used by previously ObjectContext

I'm using EF 4.1 in a web application and i'm using the UnitOfWork pattern. I open a new ObjectContext by each request and it's used for all operations in the current request. I also open and close an EntityConnection manually.

It would be better if I would not close the EntityConnection and reuse it for future request. I know that it is a Connection Pool mechanism and my ask is:

Have EF this feature included? and if not Can I use an open EntityConnection (Used from previously ObjectContext) in another ObjectContext?

The Connection String is always the same.

Upvotes: 1

Views: 293

Answers (1)

usr
usr

Reputation: 171246

No need to do that. Connection pooling is pretty fast. Just take a new connection.

Upvotes: 1

Related Questions