#1403 Refactor UnitOfWorkManager.

pull/1406/head
Halil İbrahim Kalkan 6 years ago
parent d27fccc523
commit 3b2dae6f49

@ -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;

Loading…
Cancel
Save