使用Microsoft.Practices.EnterpriseLibrary.Data
以避免泄漏时我需要处理(和销毁)?
实际上我正在处理DbCommand
和DataSet
:
VB.Net:
DataSet = DB.ExecuteDataSet(Command)
'do something ...
Command.Dispose()
Command = Nothing
DataSet.Dispose()
DataSet = Nothing
C#:
DataSet = DB.ExecuteDataSet(Command);
//do something ...
Command.Dispose();
Command = null;
DataSet.Dispose();
DataSet = null;
但这还够吗?
我需要销毁SqlDatabase
吗?怎么样DbConnection
?