Code optimization

This commit is contained in:
skx 2021-02-03 17:50:54 +08:00
parent 0c61f19b30
commit d5014ef582

View File

@ -91,7 +91,6 @@ namespace SqlSugar
{
File.Delete(fileName);
}
conn.Close();
}
catch (MySqlException ex)
{
@ -99,7 +98,7 @@ namespace SqlSugar
}
finally
{
this.Context.Ado.Close();
CloseDb();
}
return IsBulkLoad; ;
}
@ -109,6 +108,15 @@ namespace SqlSugar
return Task.FromResult(ExecuteBlueCopy());
}
private void CloseDb()
{
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Context.Ado.Transaction == null)
{
this.Context.Ado.Connection.Close();
}
}
/// <summary>
///DataTable to CSV
/// </summary>