SQL Connection Pooling in DataAccess Block

Topics: Data Access Application Block
Oct 5, 2010 at 6:28 PM

Hello, i am not really using the entlib but using lot of code from there and making custom code. I am a little new to the entlib blocks. Basicall i want to implement the sql connection code and am not sure how the connection pooling is implemented in the entlib. Can someone please point me to that part of the code/file?

a. Some things like where can i store the connection strings?
b. What are the different settings involved in the connections? Where can i find that code? Please let me know the version of the entlib that i should refer?
c. How the connection pooling is implemented?

I am assuming all the code will be contained in the DAO layer. So if in the code, do the UI need to pass the connection string details (like which database to connect), or the DAO layer will automatically know, i dont know how?

Please help!

Oct 5, 2010 at 8:26 PM


Connection strings are typically stored in the connectionStrings section in the app.config/web.config file. Entlib doesn't have any control or influence on the settings of the connection string; look at the documentation for your database provider. Each database has different settings.

Entlib doesn't do connection pooling itself, it relies on the underlying ADO.NET provider to do it. And so should you. Entlib simply opens a new connection on every request, executes the request, and closes the connection. The exception is if there's a current TransactionScope running - in that case, we don't pool connections so much as reuse a currently open one and don't close it until the end of the transaction. The ADO.NET provider under the hood manages reusing the actual physical connection to the database.