Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make base properties of common base classes protected instead of public #4178

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public abstract class AbpPageModel : PageModel

protected TService LazyGetRequiredService<TService>(ref TService reference)
=> LazyGetRequiredService(typeof(TService), ref reference);

protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference)
{
if (reference == null)
Expand All @@ -45,16 +45,16 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
return reference;
}

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _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;

protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper
protected IObjectMapper ObjectMapper
{
get
{
Expand All @@ -76,16 +76,16 @@ ref _objectMapper
}
private IObjectMapper _objectMapper;

public IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
private IGuidGenerator _guidGenerator;

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;

public IStringLocalizer L
protected IStringLocalizer L
{
get
{
Expand All @@ -102,22 +102,22 @@ public IStringLocalizer L

protected Type LocalizationResourceType { get; set; }

public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser;

public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

public ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
private ISettingProvider _settingProvider;

public IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
private IModelStateValidator _modelValidator;

public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService;

public IAlertManager AlertManager => LazyGetRequiredService(ref _alertManager);
protected IAlertManager AlertManager => LazyGetRequiredService(ref _alertManager);
private IAlertManager _alertManager;

protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
return reference;
}

public IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
private IUnitOfWorkManager _unitOfWorkManager;

protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper
protected IObjectMapper ObjectMapper
{
get
{
Expand All @@ -69,39 +69,39 @@ ref _objectMapper
}
private IObjectMapper _objectMapper;

public IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
protected IGuidGenerator GuidGenerator => LazyGetRequiredService(ref _guidGenerator);
private IGuidGenerator _guidGenerator;

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

protected ILogger Logger => _lazyLogger.Value;
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;

public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService;

protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock;

public IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
protected IModelStateValidator ModelValidator => LazyGetRequiredService(ref _modelValidator);
private IModelStateValidator _modelValidator;

public IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
private IFeatureChecker _featureChecker;

public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;

public IStringLocalizer L
protected IStringLocalizer L
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
}

protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper
protected IObjectMapper ObjectMapper
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
return reference;
}

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

protected ILogger Logger => _lazyLogger.Value;
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;

public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService;

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock;

public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;

public IStringLocalizer L
protected IStringLocalizer L
{
get
{
Expand Down Expand Up @@ -99,7 +99,7 @@ protected virtual IStringLocalizer CreateLocalizer()
}
}

public abstract class AbpHub<T> : Hub<T>
public abstract class AbpHub<T> : Hub<T>
where T : class
{
public IServiceProvider ServiceProvider { get; set; }
Expand All @@ -124,28 +124,28 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
return reference;
}

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

protected ILogger Logger => _lazyLogger.Value;
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;

public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService;

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock;

public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;

public IStringLocalizer L
protected IStringLocalizer L
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference
return reference;
}

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

protected ILogger Logger => _lazyLogger.Value;
Expand All @@ -58,4 +58,4 @@ public override string ToString()
return GetType().FullName;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ protected TRef LazyGetRequiredService<TRef>(Type serviceType, ref TRef reference

public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>();

public IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
protected IUnitOfWorkManager UnitOfWorkManager => LazyGetRequiredService(ref _unitOfWorkManager);
private IUnitOfWorkManager _unitOfWorkManager;

protected Type ObjectMapperContext { get; set; }
public IObjectMapper ObjectMapper
protected IObjectMapper ObjectMapper
{
get
{
Expand All @@ -85,31 +85,31 @@ ref _objectMapper

public IGuidGenerator GuidGenerator { get; set; }

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;

public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

public ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
protected ICurrentUser CurrentUser => LazyGetRequiredService(ref _currentUser);
private ICurrentUser _currentUser;

public ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
private ISettingProvider _settingProvider;

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock;

public IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
protected IAuthorizationService AuthorizationService => LazyGetRequiredService(ref _authorizationService);
private IAuthorizationService _authorizationService;

public IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
protected IFeatureChecker FeatureChecker => LazyGetRequiredService(ref _featureChecker);
private IFeatureChecker _featureChecker;

public IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
protected IStringLocalizerFactory StringLocalizerFactory => LazyGetRequiredService(ref _stringLocalizerFactory);
private IStringLocalizerFactory _stringLocalizerFactory;

public IStringLocalizer L
protected IStringLocalizer L
{
get
{
Expand Down Expand Up @@ -175,4 +175,4 @@ protected virtual IStringLocalizer CreateLocalizer()
return localizer;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ protected TService LazyGetRequiredService<TService>(ref TService reference)
return reference;
}

public IClock Clock => LazyGetRequiredService(ref _clock);
protected IClock Clock => LazyGetRequiredService(ref _clock);
private IClock _clock;

public IGuidGenerator GuidGenerator { get; set; }

public ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
protected ILoggerFactory LoggerFactory => LazyGetRequiredService(ref _loggerFactory);
private ILoggerFactory _loggerFactory;
public ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);

protected ICurrentTenant CurrentTenant => LazyGetRequiredService(ref _currentTenant);
private ICurrentTenant _currentTenant;

protected ILogger Logger => _lazyLogger.Value;
private Lazy<ILogger> _lazyLogger => new Lazy<ILogger>(() => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance, true);

protected DomainService()
{
GuidGenerator = SimpleGuidGenerator.Instance;
}
}
}
}