mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-21 18:48:27 +08:00
Compatible with.NET Framework
This commit is contained in:
37
Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs
Normal file
37
Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
internal static class AsyncHelper
|
||||||
|
{
|
||||||
|
public static async Task<DbTransaction> BeginTransactionAsync(this DbConnection db)
|
||||||
|
{
|
||||||
|
await Task.Delay(0);
|
||||||
|
//.net frame work no BeginTransactionAsync
|
||||||
|
return db.BeginTransaction();
|
||||||
|
}
|
||||||
|
public static async Task CloseAsync(this DbConnection db)
|
||||||
|
{
|
||||||
|
await Task.Delay(0);
|
||||||
|
//.net frame work no CloseAsync
|
||||||
|
db.Close();
|
||||||
|
}
|
||||||
|
public static async Task RollbackAsync(this DbTransaction db)
|
||||||
|
{
|
||||||
|
db.Rollback();
|
||||||
|
//.net frame work no RollbackAsync
|
||||||
|
await Task.Delay(0);
|
||||||
|
}
|
||||||
|
public static async Task CommitAsync(this DbTransaction db)
|
||||||
|
{
|
||||||
|
db.Commit();
|
||||||
|
//.net frame work no CommitAsyncAsync
|
||||||
|
await Task.Delay(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -223,6 +223,7 @@
|
|||||||
<Compile Include="Json2Sql\Queryable\QueryableProvider.cs" />
|
<Compile Include="Json2Sql\Queryable\QueryableProvider.cs" />
|
||||||
<Compile Include="Json2Sql\Utils\Json2SqlConfig.cs" />
|
<Compile Include="Json2Sql\Utils\Json2SqlConfig.cs" />
|
||||||
<Compile Include="Json2Sql\Utils\Json2SqlHelper.cs" />
|
<Compile Include="Json2Sql\Utils\Json2SqlHelper.cs" />
|
||||||
|
<Compile Include="OnlyNet\AsyncHelper.cs" />
|
||||||
<Compile Include="Realization\Dm\SqlBuilder\DmBlukCopy.cs" />
|
<Compile Include="Realization\Dm\SqlBuilder\DmBlukCopy.cs" />
|
||||||
<Compile Include="Realization\Dm\SqlBuilder\DmFastBuilder.cs" />
|
<Compile Include="Realization\Dm\SqlBuilder\DmFastBuilder.cs" />
|
||||||
<Compile Include="Realization\QuestDB\CodeFirst\QuestDBCodeFirst.cs" />
|
<Compile Include="Realization\QuestDB\CodeFirst\QuestDBCodeFirst.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user