mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Code optimization
This commit is contained in:
parent
0c61f19b30
commit
d5014ef582
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user