From 2c45d9d54cb4963b9a433de9e9d285dfc339bdde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 23 Oct 2020 16:38:36 +0300 Subject: [PATCH] Resolved #5917: Remove IHybridServiceScopeFactory usages --- .../Volo/Abp/Caching/DistributedCache.cs | 7 +++---- .../src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs | 4 ++-- .../Volo/Abp/Cli/Commands/HelpCommand.cs | 6 +++--- .../Volo/Abp/ExceptionHandling/ExceptionNotifier.cs | 4 ++-- .../src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs | 6 +++--- .../Entities/Events/Distributed/EntityToEtoMapper.cs | 8 ++++---- .../Volo/Abp/TextTemplating/TemplateContentProvider.cs | 6 +++--- .../src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs | 10 +++++----- .../Volo/Abp/Validation/ObjectValidator.cs | 8 ++++---- 9 files changed, 29 insertions(+), 30 deletions(-) diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index b26feec136..ccc1529f2b 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -10,7 +10,6 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Nito.AsyncEx; -using Volo.Abp.DependencyInjection; using Volo.Abp.ExceptionHandling; using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; @@ -31,7 +30,7 @@ namespace Volo.Abp.Caching ICancellationTokenProvider cancellationTokenProvider, IDistributedCacheSerializer serializer, IDistributedCacheKeyNormalizer keyNormalizer, - IHybridServiceScopeFactory serviceScopeFactory, + IServiceScopeFactory serviceScopeFactory, IUnitOfWorkManager unitOfWorkManager) : base( distributedCacheOption: distributedCacheOption, cache: cache, @@ -69,7 +68,7 @@ namespace Volo.Abp.Caching protected IDistributedCacheKeyNormalizer KeyNormalizer { get; } - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } protected IUnitOfWorkManager UnitOfWorkManager { get; } @@ -85,7 +84,7 @@ namespace Volo.Abp.Caching ICancellationTokenProvider cancellationTokenProvider, IDistributedCacheSerializer serializer, IDistributedCacheKeyNormalizer keyNormalizer, - IHybridServiceScopeFactory serviceScopeFactory, + IServiceScopeFactory serviceScopeFactory, IUnitOfWorkManager unitOfWorkManager) { _distributedCacheOption = distributedCacheOption.Value; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index a178f489ff..785d2ff3fc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs @@ -20,13 +20,13 @@ namespace Volo.Abp.Cli public ILogger Logger { get; set; } protected ICommandLineArgumentParser CommandLineArgumentParser { get; } protected ICommandSelector CommandSelector { get; } - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } protected NuGetService NuGetService { get; } public CliService( ICommandLineArgumentParser commandLineArgumentParser, ICommandSelector commandSelector, - IHybridServiceScopeFactory serviceScopeFactory, + IServiceScopeFactory serviceScopeFactory, NuGetService nugetService) { CommandLineArgumentParser = commandLineArgumentParser; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 70d5112e95..d59b8a9bb5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -14,10 +14,10 @@ namespace Volo.Abp.Cli.Commands { public ILogger Logger { get; set; } protected AbpCliOptions AbpCliOptions { get; } - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } public HelpCommand(IOptions cliOptions, - IHybridServiceScopeFactory serviceScopeFactory) + IServiceScopeFactory serviceScopeFactory) { ServiceScopeFactory = serviceScopeFactory; Logger = NullLogger.Instance; @@ -94,4 +94,4 @@ namespace Volo.Abp.Cli.Commands return "Show command line help. Write ` abp help `"; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs b/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs index 232b9a2ecd..e681b6d6f7 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs @@ -12,9 +12,9 @@ namespace Volo.Abp.ExceptionHandling { public ILogger Logger { get; set; } - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } - public ExceptionNotifier(IHybridServiceScopeFactory serviceScopeFactory) + public ExceptionNotifier(IServiceScopeFactory serviceScopeFactory) { ServiceScopeFactory = serviceScopeFactory; Logger = NullLogger.Instance; diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs index c20badbeb7..cc282007de 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs @@ -9,12 +9,12 @@ namespace Volo.Abp.Data //TODO: Create a Volo.Abp.Data.Seeding namespace? public class DataSeeder : IDataSeeder, ITransientDependency { - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } protected AbpDataSeedOptions Options { get; } public DataSeeder( IOptions options, - IHybridServiceScopeFactory serviceScopeFactory) + IServiceScopeFactory serviceScopeFactory) { ServiceScopeFactory = serviceScopeFactory; Options = options.Value; @@ -36,4 +36,4 @@ namespace Volo.Abp.Data } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs index 15a41bad9d..2ba6aaebee 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs @@ -9,13 +9,13 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed { public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency { - protected IHybridServiceScopeFactory HybridServiceScopeFactory { get; } - + protected IServiceScopeFactory HybridServiceScopeFactory { get; } + protected AbpDistributedEntityEventOptions Options { get; } public EntityToEtoMapper( IOptions options, - IHybridServiceScopeFactory hybridServiceScopeFactory) + IServiceScopeFactory hybridServiceScopeFactory) { HybridServiceScopeFactory = hybridServiceScopeFactory; Options = options.Value; @@ -51,4 +51,4 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs index 55a3979e21..e084abeb05 100644 --- a/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs +++ b/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs @@ -12,13 +12,13 @@ namespace Volo.Abp.TextTemplating { public class TemplateContentProvider : ITemplateContentProvider, ITransientDependency { - public IHybridServiceScopeFactory ServiceScopeFactory { get; } + public IServiceScopeFactory ServiceScopeFactory { get; } public AbpTextTemplatingOptions Options { get; } private readonly ITemplateDefinitionManager _templateDefinitionManager; public TemplateContentProvider( ITemplateDefinitionManager templateDefinitionManager, - IHybridServiceScopeFactory serviceScopeFactory, + IServiceScopeFactory serviceScopeFactory, IOptions options) { ServiceScopeFactory = serviceScopeFactory; @@ -167,4 +167,4 @@ namespace Volo.Abp.TextTemplating return null; } } -} \ No newline at end of file +} 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 0a1fcc7a9f..3a3ef1fbd6 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs @@ -7,12 +7,12 @@ namespace Volo.Abp.Uow { public IUnitOfWork Current => GetCurrentUnitOfWork(); - private readonly IHybridServiceScopeFactory _serviceScopeFactory; + private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IAmbientUnitOfWork _ambientUnitOfWork; public UnitOfWorkManager( - IAmbientUnitOfWork ambientUnitOfWork, - IHybridServiceScopeFactory serviceScopeFactory) + IAmbientUnitOfWork ambientUnitOfWork, + IServiceScopeFactory serviceScopeFactory) { _ambientUnitOfWork = ambientUnitOfWork; _serviceScopeFactory = serviceScopeFactory; @@ -38,7 +38,7 @@ namespace Volo.Abp.Uow { Check.NotNull(reservationName, nameof(reservationName)); - if (!requiresNew && + if (!requiresNew && _ambientUnitOfWork.UnitOfWork != null && _ambientUnitOfWork.UnitOfWork.IsReservedFor(reservationName)) { @@ -122,4 +122,4 @@ namespace Volo.Abp.Uow } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs index 784c211061..d8e0c60b65 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs @@ -9,10 +9,10 @@ namespace Volo.Abp.Validation { public class ObjectValidator : IObjectValidator, ITransientDependency { - protected IHybridServiceScopeFactory ServiceScopeFactory { get; } + protected IServiceScopeFactory ServiceScopeFactory { get; } protected AbpValidationOptions Options { get; } - public ObjectValidator(IOptions options, IHybridServiceScopeFactory serviceScopeFactory) + public ObjectValidator(IOptions options, IServiceScopeFactory serviceScopeFactory) { ServiceScopeFactory = serviceScopeFactory; Options = options.Value; @@ -56,7 +56,7 @@ namespace Volo.Abp.Validation { foreach (var contributorType in Options.ObjectValidationContributors) { - var contributor = (IObjectValidationContributor) + var contributor = (IObjectValidationContributor) scope.ServiceProvider.GetRequiredService(contributorType); contributor.AddErrors(context); } @@ -65,4 +65,4 @@ namespace Volo.Abp.Validation return context.Errors; } } -} \ No newline at end of file +}