DAAB 5.0 - Database Instance best approach?

Topics: Data Access Application Block
Jun 17, 2011 at 10:09 AM

Hi

I have a web application with SQL Server 2008 with lot of stored procedure calls but pointing to single database. What is best approach to implement CreateDatabase instance using DAAB?

-  Do I have to call DatabaseFactory.CreateDatabase(); within each method which calls SP using DBCommand ?

or is there a better approach in getting this done?

Please suggest. Thanks!

 

 

Jun 17, 2011 at 11:02 AM

Hi,

According to Chris Tavares in this post, you can actually create your database instance whenever you need it. If you are using Enterprise Library 5.0, there is another way of creating your database object, by using Unity Service Locator. You may want to take a look on it and see if you can take advantage of it. For more details, refer to this link.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 17, 2011 at 11:15 AM

Thanks. My application is used in production by multiple users at same time. 

By creating Database instances for each function, would this affect connection pooiling ? or DAAB would take care of disposing the connection object each time?

Jun 17, 2011 at 11:33 AM

Yes, DAAB will take care of it. Actually it is still the ADO.NET which handles connection pooling since DAAB is just sitting on top of it.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com