mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Code optimization
This commit is contained in:
@@ -91,7 +91,6 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
}
|
}
|
||||||
conn.Close();
|
|
||||||
}
|
}
|
||||||
catch (MySqlException ex)
|
catch (MySqlException ex)
|
||||||
{
|
{
|
||||||
@@ -99,7 +98,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
this.Context.Ado.Close();
|
CloseDb();
|
||||||
}
|
}
|
||||||
return IsBulkLoad; ;
|
return IsBulkLoad; ;
|
||||||
}
|
}
|
||||||
@@ -109,6 +108,15 @@ namespace SqlSugar
|
|||||||
return Task.FromResult(ExecuteBlueCopy());
|
return Task.FromResult(ExecuteBlueCopy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CloseDb()
|
||||||
|
{
|
||||||
|
if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection && this.Context.Ado.Transaction == null)
|
||||||
|
{
|
||||||
|
this.Context.Ado.Connection.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///DataTable to CSV
|
///DataTable to CSV
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user