From 3b2dae6f490cd6147c3271afd9f97cf48794b85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 28 Jun 2019 19:30:33 +0300 Subject: [PATCH] #1403 Refactor UnitOfWorkManager. --- .../Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs index 4523f8f8f7..5063f6eed5 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs @@ -4,19 +4,19 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.Uow { - public class UnitOfWorkManager : IUnitOfWorkManager, ISingletonDependency + public class UnitOfWorkManager : IUnitOfWorkManager, ITransientDependency { public IUnitOfWork Current => GetCurrentUnitOfWork(); - private readonly IServiceProvider _serviceProvider; + private readonly IHybridServiceScopeFactory _serviceScopeFactory; private readonly IAmbientUnitOfWork _ambientUnitOfWork; public UnitOfWorkManager( - IServiceProvider serviceProvider, - IAmbientUnitOfWork ambientUnitOfWork) + IAmbientUnitOfWork ambientUnitOfWork, + IHybridServiceScopeFactory serviceScopeFactory) { - _serviceProvider = serviceProvider; _ambientUnitOfWork = ambientUnitOfWork; + _serviceScopeFactory = serviceScopeFactory; } public IUnitOfWork Begin(UnitOfWorkOptions options, bool requiresNew = false) @@ -97,7 +97,7 @@ namespace Volo.Abp.Uow private IUnitOfWork CreateNewUnitOfWork() { - var scope = _serviceProvider.CreateScope(); + var scope = _serviceScopeFactory.CreateScope(); try { var outerUow = _ambientUnitOfWork.UnitOfWork;