DatabaseFactory.CreateDatabase

Topics: Data Access Application Block
Aug 28, 2008 at 8:34 AM
Hi
The method "DatabaseFactory.CreateDatabase(connection_name)" returns a connection to a database (I think).  Does this connection need to be closed?
Like normally I enclose my use of database resources in a "using" block - is this necessary with "CreateDatabase"?

Thanks,
Peter
Aug 28, 2008 at 1:56 PM
Hi Peter,

CreateDatabase creates a Database object that will open (and close) connections to a database when necessary (eg when running a query). Database does no implement IDisposable, so you cannot use it in a using statement (and there's no need for it).

Fernando