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(); }