我在使用// In MyParentComponent
componentDidUpdate(prevProps, prevState) {
if (prevState.valueSelected !== this.state.valueSelected)
this.refs.myInput.value = ''; // Do this for each input, you'll need to add a unique ref attribute for each one
}
...
时找到的每个示例都类似于:
ReliableSqlConnection
当using (var cnn = new ReliableSqlConnection(connString))
{
using (var cmd = cnn.CreateCommand())
{
cnn.Open();
...
}
}
返回Open()
SQLConnection
时,是否应该处理?
如果我将其封装在using语句中,会不会产生任何影响或伤害?
IDisposable
答案 0 :(得分:0)
您无需处置,已弃用的 ReliableSQLConnection
类会在其ctor中创建SqlConnection
并将其置于其Dispose()
中:
private void Dispose(bool disposing)
{
if (disposing)
{
if (this.underlyingConnection.State == ConnectionState.Open)
{
this.underlyingConnection.Close();
}
this.underlyingConnection.Dispose();
}
}