Browse Source

Merge pull request #4178 from abpframework/maliming/protected

Make base properties of common base classes protected instead of public
pull/4276/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
6904a22241
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs
  2. 24
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs
  4. 30
      framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs
  5. 4
      framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs
  6. 24
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs
  7. 12
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs

30
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs

@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages
protected TService LazyGetRequiredService<TService>(ref TService reference) protected TService LazyGetRequiredService<TService>(ref TService reference)
=> LazyGetRequiredService(typeof(TService), ref reference); => LazyGetRequiredService(typeof(TService), ref reference);
protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference) protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference)
{ {
if (reference == null) if (reference == null)
@ -45,16 +45,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages
return reference; return reference;
} }
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public AlertList Alerts => AlertManager.Alerts; protected AlertList Alerts => AlertManager.Alerts;
public IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
private IUnitOfWorkManager _unitOfWorkManager; private IUnitOfWorkManager _unitOfWorkManager;
protected Type ObjectMapperContext { get; set; } protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper protected IObjectMapper ObjectMapper
{ {
get get
{ {
@ -76,16 +76,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages
} }
private IObjectMapper _objectMapper; private IObjectMapper _objectMapper;
public IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator); protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
private IGuidGenerator _guidGenerator; private IGuidGenerator _guidGenerator;
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory; private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L protected IStringLocalizer L
{ {
get get
{ {
@ -102,22 +102,22 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages
protected Type LocalizationResourceType { get; set; } protected Type LocalizationResourceType { get; set; }
public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser; private ICurrentUser _currentUser;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
public ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider); protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
private ISettingProvider _settingProvider; private ISettingProvider _settingProvider;
public IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator); protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
private IModelStateValidator _modelValidator; private IModelStateValidator _modelValidator;
public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService; private IAuthorizationService _authorizationService;
public IAlertManager AlertManager => LazyGetRequiredService(ref _alertManager); protected IAlertManager AlertManager => LazyGetRequiredService(ref _alertManager);
private IAlertManager _alertManager; private IAlertManager _alertManager;
protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;

24
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs

@ -43,11 +43,11 @@ namespace Volo.Abp.AspNetCore.Mvc
return reference; return reference;
} }
public IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
private IUnitOfWorkManager _unitOfWorkManager; private IUnitOfWorkManager _unitOfWorkManager;
protected Type ObjectMapperContext { get; set; } protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper protected IObjectMapper ObjectMapper
{ {
get get
{ {
@ -69,39 +69,39 @@ namespace Volo.Abp.AspNetCore.Mvc
} }
private IObjectMapper _objectMapper; private IObjectMapper _objectMapper;
public IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator); protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
private IGuidGenerator _guidGenerator; private IGuidGenerator _guidGenerator;
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
protected ILogger Logger => _lazyLogger.Value; protected ILogger Logger => _lazyLogger.Value;
private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true);
public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser; private ICurrentUser _currentUser;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService; private IAuthorizationService _authorizationService;
protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator); protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
private IModelStateValidator _modelValidator; private IModelStateValidator _modelValidator;
public IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker); protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
private IFeatureChecker _featureChecker; private IFeatureChecker _featureChecker;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory; private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L protected IStringLocalizer L
{ {
get get
{ {

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs

@ -30,7 +30,7 @@ namespace Volo.Abp.AspNetCore.Mvc
} }
protected Type ObjectMapperContext { get; set; } protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper protected IObjectMapper ObjectMapper
{ {
get get
{ {

30
framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs

@ -36,28 +36,28 @@ namespace Volo.Abp.AspNetCore.SignalR
return reference; return reference;
} }
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
protected ILogger Logger => _lazyLogger.Value; protected ILogger Logger => _lazyLogger.Value;
private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true);
public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser; private ICurrentUser _currentUser;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService; private IAuthorizationService _authorizationService;
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory; private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L protected IStringLocalizer L
{ {
get get
{ {
@ -99,7 +99,7 @@ namespace Volo.Abp.AspNetCore.SignalR
} }
} }
public abstract class AbpHub<T> : Hub<T> public abstract class AbpHub<T> : Hub<T>
where T : class where T : class
{ {
public IServiceProvider ServiceProvider { get; set; } public IServiceProvider ServiceProvider { get; set; }
@ -124,28 +124,28 @@ namespace Volo.Abp.AspNetCore.SignalR
return reference; return reference;
} }
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
protected ILogger Logger => _lazyLogger.Value; protected ILogger Logger => _lazyLogger.Value;
private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true);
public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser; private ICurrentUser _currentUser;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService; private IAuthorizationService _authorizationService;
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory; private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L protected IStringLocalizer L
{ {
get get
{ {

4
framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs

@ -35,7 +35,7 @@ namespace Volo.Abp.BackgroundWorkers
return reference; return reference;
} }
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
protected ILogger Logger => _lazyLogger.Value; protected ILogger Logger => _lazyLogger.Value;
@ -58,4 +58,4 @@ namespace Volo.Abp.BackgroundWorkers
return GetType().FullName; return GetType().FullName;
} }
} }
} }

24
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs

@ -57,11 +57,11 @@ namespace Volo.Abp.Application.Services
public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>(); public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>();
public IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager); protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
private IUnitOfWorkManager _unitOfWorkManager; private IUnitOfWorkManager _unitOfWorkManager;
protected Type ObjectMapperContext { get; set; } protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper protected IObjectMapper ObjectMapper
{ {
get get
{ {
@ -85,31 +85,31 @@ namespace Volo.Abp.Application.Services
public IGuidGenerator GuidGenerator { get; set; } public IGuidGenerator GuidGenerator { get; set; }
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser); protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser; private ICurrentUser _currentUser;
public ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider); protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
private ISettingProvider _settingProvider; private ISettingProvider _settingProvider;
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService); protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService; private IAuthorizationService _authorizationService;
public IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker); protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
private IFeatureChecker _featureChecker; private IFeatureChecker _featureChecker;
public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory); protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory; private IStringLocalizerFactory _stringLocalizerFactory;
public IStringLocalizer L protected IStringLocalizer L
{ {
get get
{ {
@ -175,4 +175,4 @@ namespace Volo.Abp.Application.Services
return localizer; return localizer;
} }
} }
} }

12
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs

@ -28,23 +28,23 @@ namespace Volo.Abp.Domain.Services
return reference; return reference;
} }
public IClock Clock => LazyGetRequiredService(ref _clock); protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock; private IClock _clock;
public IGuidGenerator GuidGenerator { get; set; } public IGuidGenerator GuidGenerator { get; set; }
public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory); protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory; private ILoggerFactory _loggerFactory;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant); protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant; private ICurrentTenant _currentTenant;
protected ILogger Logger => _lazyLogger.Value; protected ILogger Logger => _lazyLogger.Value;
private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true); private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true);
protected DomainService() protected DomainService()
{ {
GuidGenerator = SimpleGuidGenerator.Instance; GuidGenerator = SimpleGuidGenerator.Instance;
} }
} }
} }

Loading…
Cancel
Save