From 32d4f671fe73e1f339b9d65ec7dc3199f658cbaa Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Mon, 7 Dec 2020 15:44:12 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=202.0.103=20Uow.Orm=20?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=20bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aspnetcore_transaction/Controllers/HomeController.cs | 4 ++++ .../aspnetcore_transaction/aspnetcore_transaction.csproj | 4 ++-- FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Examples/aspnetcore_transaction/Controllers/HomeController.cs b/Examples/aspnetcore_transaction/Controllers/HomeController.cs index 269d1f0d..75076486 100644 --- a/Examples/aspnetcore_transaction/Controllers/HomeController.cs +++ b/Examples/aspnetcore_transaction/Controllers/HomeController.cs @@ -27,6 +27,10 @@ namespace aspnetcore_transaction.Controllers virtual public object Get([FromServices] BaseRepository repoSong, [FromServices] BaseRepository repoDetail, [FromServices] SongRepository repoSong2, [FromServices] SongService serviceSong) { + //repoSong.Insert(new Song()); + //repoDetail.Insert(new Detail()); + //repoSong2.Insert(new Song()); + serviceSong.Test1(); return "111"; } diff --git a/Examples/aspnetcore_transaction/aspnetcore_transaction.csproj b/Examples/aspnetcore_transaction/aspnetcore_transaction.csproj index ee51821c..f385c178 100644 --- a/Examples/aspnetcore_transaction/aspnetcore_transaction.csproj +++ b/Examples/aspnetcore_transaction/aspnetcore_transaction.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs index b5892dbd..ec9def63 100644 --- a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs +++ b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs @@ -13,7 +13,8 @@ namespace FreeSql /// public class UnitOfWorkManager : IDisposable { - DbContextScopedFreeSql _ormScoped; + internal DbContextScopedFreeSql _ormScoped; + internal IFreeSql OrmOriginal => _ormScoped?._originalFsql; public IFreeSql Orm => _ormScoped; List _rawUows = new List(); List _allUows = new List(); @@ -136,7 +137,7 @@ namespace FreeSql } IUnitOfWork CreateUow(IsolationLevel? isolationLevel) { - var uow = new UnitOfWorkOrginal(new UnitOfWork(Orm)); + var uow = new UnitOfWorkOrginal(new UnitOfWork(OrmOriginal)); var uowInfo = new UowInfo(uow, UowInfo.UowType.Orginal, false); if (isolationLevel != null) uow.IsolationLevel = isolationLevel.Value; try { uow.GetOrBeginTransaction(); }