How expensive is DatabaseFactory.CreateDatabase?

Topics: Data Access Application Block
Oct 3, 2008 at 6:35 PM
Should I aim to call CreateDatabase once, and then reuse that Database object throughout my application, or can I create a new Database object every time I need to access the database?
And are database connections pooled across all database objects? (If not, creating Database objects on the fly is obviously a pretty bad idea)

I haven't been able to find any documentation on this. Anyone know?
Oct 9, 2008 at 5:03 AM
Hi,
Interesting question,I was wondering that too.At the moment I create a database in each method which seems an overkill.
Oct 9, 2008 at 1:28 PM
Either way is fine. Since we cache all the parameters to create the Database object, so calling create more than once per App Domain is not a problem.  If you want to cache the Database object, that would be fine too, although in a stateless environment, that may not be possible.
Oct 10, 2008 at 2:54 AM
Hi,

I think DatabaseFactory.CreateDatabase is not a expensive call, please read this post.


http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=34447

Thanks

.Kratos