From b1420cf5038f27329fef41804d8c02e3ae98e0fb Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 11 Dec 2022 16:16:16 +0800 Subject: [PATCH] Compatible with.NET Framework --- Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs | 37 +++++++++++++++++++++ Src/Asp.Net/SqlSugar/SqlSugar.csproj | 1 + 2 files changed, 38 insertions(+) create mode 100644 Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs diff --git a/Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs b/Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs new file mode 100644 index 000000000..5e4799e7d --- /dev/null +++ b/Src/Asp.Net/SqlSugar/OnlyNet/AsyncHelper.cs @@ -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 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); + } + } +} diff --git a/Src/Asp.Net/SqlSugar/SqlSugar.csproj b/Src/Asp.Net/SqlSugar/SqlSugar.csproj index 118f85666..b65f69601 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugar.csproj +++ b/Src/Asp.Net/SqlSugar/SqlSugar.csproj @@ -223,6 +223,7 @@ +