We have been using Microsoft Enterprise Lib for data access, some old legacy code and are using LoadDataSet method. Does this method close the db connection or do we have to explicitly close open connections?
The LoadDataSet
method will close the Database connection before returning. First an open connection is returned, then the DataSet is filled and then the connection is closed (actually Disposed).
You can see this in the source of Database.cs:
public virtual void LoadDataSet(DbCommand command,
DataSet dataSet,
string[] tableNames)
{
using (var wrapper = GetOpenConnection())
{
PrepareCommand(command, wrapper.Connection);
DoLoadDataSet(command, dataSet, tableNames);
}
}