Browse Source

Resolved #5917: Remove IHybridServiceScopeFactory usages

pull/5922/head
Halil İbrahim Kalkan 6 years ago
parent
commit
2c45d9d54c
  1. 7
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  2. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
  3. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs
  4. 4
      framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs
  5. 6
      framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs
  6. 8
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs
  7. 6
      framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs
  8. 10
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs
  9. 8
      framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs

7
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.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Nito.AsyncEx; using Nito.AsyncEx;
using Volo.Abp.DependencyInjection;
using Volo.Abp.ExceptionHandling; using Volo.Abp.ExceptionHandling;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading; using Volo.Abp.Threading;
@ -31,7 +30,7 @@ namespace Volo.Abp.Caching
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer, IDistributedCacheSerializer serializer,
IDistributedCacheKeyNormalizer keyNormalizer, IDistributedCacheKeyNormalizer keyNormalizer,
IHybridServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
IUnitOfWorkManager unitOfWorkManager) : base( IUnitOfWorkManager unitOfWorkManager) : base(
distributedCacheOption: distributedCacheOption, distributedCacheOption: distributedCacheOption,
cache: cache, cache: cache,
@ -69,7 +68,7 @@ namespace Volo.Abp.Caching
protected IDistributedCacheKeyNormalizer KeyNormalizer { get; } protected IDistributedCacheKeyNormalizer KeyNormalizer { get; }
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected IUnitOfWorkManager UnitOfWorkManager { get; } protected IUnitOfWorkManager UnitOfWorkManager { get; }
@ -85,7 +84,7 @@ namespace Volo.Abp.Caching
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer, IDistributedCacheSerializer serializer,
IDistributedCacheKeyNormalizer keyNormalizer, IDistributedCacheKeyNormalizer keyNormalizer,
IHybridServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
IUnitOfWorkManager unitOfWorkManager) IUnitOfWorkManager unitOfWorkManager)
{ {
_distributedCacheOption = distributedCacheOption.Value; _distributedCacheOption = distributedCacheOption.Value;

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs

@ -20,13 +20,13 @@ namespace Volo.Abp.Cli
public ILogger<CliService> Logger { get; set; } public ILogger<CliService> Logger { get; set; }
protected ICommandLineArgumentParser CommandLineArgumentParser { get; } protected ICommandLineArgumentParser CommandLineArgumentParser { get; }
protected ICommandSelector CommandSelector { get; } protected ICommandSelector CommandSelector { get; }
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected NuGetService NuGetService { get; } protected NuGetService NuGetService { get; }
public CliService( public CliService(
ICommandLineArgumentParser commandLineArgumentParser, ICommandLineArgumentParser commandLineArgumentParser,
ICommandSelector commandSelector, ICommandSelector commandSelector,
IHybridServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
NuGetService nugetService) NuGetService nugetService)
{ {
CommandLineArgumentParser = commandLineArgumentParser; CommandLineArgumentParser = commandLineArgumentParser;

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs

@ -14,10 +14,10 @@ namespace Volo.Abp.Cli.Commands
{ {
public ILogger<HelpCommand> Logger { get; set; } public ILogger<HelpCommand> Logger { get; set; }
protected AbpCliOptions AbpCliOptions { get; } protected AbpCliOptions AbpCliOptions { get; }
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
public HelpCommand(IOptions<AbpCliOptions> cliOptions, public HelpCommand(IOptions<AbpCliOptions> cliOptions,
IHybridServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
{ {
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
Logger = NullLogger<HelpCommand>.Instance; Logger = NullLogger<HelpCommand>.Instance;
@ -94,4 +94,4 @@ namespace Volo.Abp.Cli.Commands
return "Show command line help. Write ` abp help <command> `"; return "Show command line help. Write ` abp help <command> `";
} }
} }
} }

4
framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionNotifier.cs

@ -12,9 +12,9 @@ namespace Volo.Abp.ExceptionHandling
{ {
public ILogger<ExceptionNotifier> Logger { get; set; } public ILogger<ExceptionNotifier> Logger { get; set; }
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
public ExceptionNotifier(IHybridServiceScopeFactory serviceScopeFactory) public ExceptionNotifier(IServiceScopeFactory serviceScopeFactory)
{ {
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
Logger = NullLogger<ExceptionNotifier>.Instance; Logger = NullLogger<ExceptionNotifier>.Instance;

6
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? //TODO: Create a Volo.Abp.Data.Seeding namespace?
public class DataSeeder : IDataSeeder, ITransientDependency public class DataSeeder : IDataSeeder, ITransientDependency
{ {
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected AbpDataSeedOptions Options { get; } protected AbpDataSeedOptions Options { get; }
public DataSeeder( public DataSeeder(
IOptions<AbpDataSeedOptions> options, IOptions<AbpDataSeedOptions> options,
IHybridServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
{ {
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
Options = options.Value; Options = options.Value;
@ -36,4 +36,4 @@ namespace Volo.Abp.Data
} }
} }
} }
} }

8
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 public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency
{ {
protected IHybridServiceScopeFactory HybridServiceScopeFactory { get; } protected IServiceScopeFactory HybridServiceScopeFactory { get; }
protected AbpDistributedEntityEventOptions Options { get; } protected AbpDistributedEntityEventOptions Options { get; }
public EntityToEtoMapper( public EntityToEtoMapper(
IOptions<AbpDistributedEntityEventOptions> options, IOptions<AbpDistributedEntityEventOptions> options,
IHybridServiceScopeFactory hybridServiceScopeFactory) IServiceScopeFactory hybridServiceScopeFactory)
{ {
HybridServiceScopeFactory = hybridServiceScopeFactory; HybridServiceScopeFactory = hybridServiceScopeFactory;
Options = options.Value; Options = options.Value;
@ -51,4 +51,4 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed
} }
} }
} }
} }

6
framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating/TemplateContentProvider.cs

@ -12,13 +12,13 @@ namespace Volo.Abp.TextTemplating
{ {
public class TemplateContentProvider : ITemplateContentProvider, ITransientDependency public class TemplateContentProvider : ITemplateContentProvider, ITransientDependency
{ {
public IHybridServiceScopeFactory ServiceScopeFactory { get; } public IServiceScopeFactory ServiceScopeFactory { get; }
public AbpTextTemplatingOptions Options { get; } public AbpTextTemplatingOptions Options { get; }
private readonly ITemplateDefinitionManager _templateDefinitionManager; private readonly ITemplateDefinitionManager _templateDefinitionManager;
public TemplateContentProvider( public TemplateContentProvider(
ITemplateDefinitionManager templateDefinitionManager, ITemplateDefinitionManager templateDefinitionManager,
IHybridServiceScopeFactory serviceScopeFactory, IServiceScopeFactory serviceScopeFactory,
IOptions<AbpTextTemplatingOptions> options) IOptions<AbpTextTemplatingOptions> options)
{ {
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
@ -167,4 +167,4 @@ namespace Volo.Abp.TextTemplating
return null; return null;
} }
} }
} }

10
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManager.cs

@ -7,12 +7,12 @@ namespace Volo.Abp.Uow
{ {
public IUnitOfWork Current => GetCurrentUnitOfWork(); public IUnitOfWork Current => GetCurrentUnitOfWork();
private readonly IHybridServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly IAmbientUnitOfWork _ambientUnitOfWork; private readonly IAmbientUnitOfWork _ambientUnitOfWork;
public UnitOfWorkManager( public UnitOfWorkManager(
IAmbientUnitOfWork ambientUnitOfWork, IAmbientUnitOfWork ambientUnitOfWork,
IHybridServiceScopeFactory serviceScopeFactory) IServiceScopeFactory serviceScopeFactory)
{ {
_ambientUnitOfWork = ambientUnitOfWork; _ambientUnitOfWork = ambientUnitOfWork;
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
@ -38,7 +38,7 @@ namespace Volo.Abp.Uow
{ {
Check.NotNull(reservationName, nameof(reservationName)); Check.NotNull(reservationName, nameof(reservationName));
if (!requiresNew && if (!requiresNew &&
_ambientUnitOfWork.UnitOfWork != null && _ambientUnitOfWork.UnitOfWork != null &&
_ambientUnitOfWork.UnitOfWork.IsReservedFor(reservationName)) _ambientUnitOfWork.UnitOfWork.IsReservedFor(reservationName))
{ {
@ -122,4 +122,4 @@ namespace Volo.Abp.Uow
} }
} }
} }
} }

8
framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ObjectValidator.cs

@ -9,10 +9,10 @@ namespace Volo.Abp.Validation
{ {
public class ObjectValidator : IObjectValidator, ITransientDependency public class ObjectValidator : IObjectValidator, ITransientDependency
{ {
protected IHybridServiceScopeFactory ServiceScopeFactory { get; } protected IServiceScopeFactory ServiceScopeFactory { get; }
protected AbpValidationOptions Options { get; } protected AbpValidationOptions Options { get; }
public ObjectValidator(IOptions<AbpValidationOptions> options, IHybridServiceScopeFactory serviceScopeFactory) public ObjectValidator(IOptions<AbpValidationOptions> options, IServiceScopeFactory serviceScopeFactory)
{ {
ServiceScopeFactory = serviceScopeFactory; ServiceScopeFactory = serviceScopeFactory;
Options = options.Value; Options = options.Value;
@ -56,7 +56,7 @@ namespace Volo.Abp.Validation
{ {
foreach (var contributorType in Options.ObjectValidationContributors) foreach (var contributorType in Options.ObjectValidationContributors)
{ {
var contributor = (IObjectValidationContributor) var contributor = (IObjectValidationContributor)
scope.ServiceProvider.GetRequiredService(contributorType); scope.ServiceProvider.GetRequiredService(contributorType);
contributor.AddErrors(context); contributor.AddErrors(context);
} }
@ -65,4 +65,4 @@ namespace Volo.Abp.Validation
return context.Errors; return context.Errors;
} }
} }
} }

Loading…
Cancel
Save