diff --git a/Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs index 2fa2897c7..d74b239da 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/Demo1_Queryable.cs @@ -27,7 +27,15 @@ namespace OrmTest private static void ConfiQuery() { var db = GetInstance(); - List datas = new List(); + using (var tran = db.UseTran()) + { + + + tran.CommitTran(); + } + + + List datas = new List(); datas.Add(new DataDictionary() { Code="1", Name="男",Type="sex" }); datas.Add(new DataDictionary() { Code = "2", Name = "女", Type = "sex" }); datas.Add(new DataDictionary() { Code = "1", Name = "南通市", Type = "city" }); diff --git a/Src/Asp.Net/SqlSugar/Entities/SqlSguarTransaction.cs b/Src/Asp.Net/SqlSugar/Entities/SqlSguarTransaction.cs index ab756bb96..6177b27d7 100644 --- a/Src/Asp.Net/SqlSugar/Entities/SqlSguarTransaction.cs +++ b/Src/Asp.Net/SqlSugar/Entities/SqlSguarTransaction.cs @@ -15,6 +15,14 @@ namespace SqlSugar context = client; context.BeginTran(); } + public void CommitTran() + { + context.CommitTran(); + } + public void RollbackTran() + { + context.RollbackTran(); + } public void Dispose() { context.RollbackTran();