Fix naming conventions for private fields
This commit is contained in:
@ -12,13 +12,13 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
public class InstallationManager : IInstallationManager
|
||||
{
|
||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
private readonly IHostApplicationLifetime _hostApplicationLifetime;
|
||||
private readonly IWebHostEnvironment _environment;
|
||||
|
||||
public InstallationManager(IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
||||
{
|
||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
||||
this.environment = environment;
|
||||
this._hostApplicationLifetime = HostApplicationLifetime;
|
||||
this._environment = environment;
|
||||
}
|
||||
|
||||
public void InstallPackages(string Folders, bool Restart)
|
||||
@ -28,7 +28,7 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
foreach (string Folder in Folders.Split(','))
|
||||
{
|
||||
string folder = Path.Combine(environment.WebRootPath, Folder);
|
||||
string folder = Path.Combine(_environment.WebRootPath, Folder);
|
||||
|
||||
// create folder if it does not exist
|
||||
if (!Directory.Exists(folder))
|
||||
@ -113,7 +113,7 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
public void UpgradeFramework()
|
||||
{
|
||||
string folder = Path.Combine(environment.WebRootPath, "Framework");
|
||||
string folder = Path.Combine(_environment.WebRootPath, "Framework");
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
// get package with highest version and clean up any others
|
||||
@ -189,7 +189,7 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
public void RestartApplication()
|
||||
{
|
||||
HostApplicationLifetime.StopApplication();
|
||||
_hostApplicationLifetime.StopApplication();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ namespace Oqtane.Infrastructure
|
||||
public abstract class HostedServiceBase : IHostedService, IDisposable
|
||||
{
|
||||
private Task ExecutingTask;
|
||||
private readonly CancellationTokenSource CancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly IServiceScopeFactory ServiceScopeFactory;
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
public HostedServiceBase(IServiceScopeFactory ServiceScopeFactory)
|
||||
{
|
||||
this.ServiceScopeFactory = ServiceScopeFactory;
|
||||
this._serviceScopeFactory = ServiceScopeFactory;
|
||||
}
|
||||
|
||||
// abstract method must be overridden
|
||||
@ -31,7 +31,7 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
using (var scope = _serviceScopeFactory.CreateScope())
|
||||
{
|
||||
// get name of job
|
||||
string JobType = Utilities.GetFullTypeName(this.GetType().AssemblyQualifiedName);
|
||||
@ -144,7 +144,7 @@ namespace Oqtane.Infrastructure
|
||||
try
|
||||
{
|
||||
// set IsExecuting to false in case this job was forcefully terminated previously
|
||||
using (var scope = ServiceScopeFactory.CreateScope())
|
||||
using (var scope = _serviceScopeFactory.CreateScope())
|
||||
{
|
||||
string JobType = Utilities.GetFullTypeName(this.GetType().AssemblyQualifiedName);
|
||||
IJobRepository Jobs = scope.ServiceProvider.GetRequiredService<IJobRepository>();
|
||||
@ -162,7 +162,7 @@ namespace Oqtane.Infrastructure
|
||||
// can occur during the initial installation as there is no DBContext
|
||||
}
|
||||
|
||||
ExecutingTask = ExecuteAsync(CancellationTokenSource.Token);
|
||||
ExecutingTask = ExecuteAsync(_cancellationTokenSource.Token);
|
||||
|
||||
if (ExecutingTask.IsCompleted)
|
||||
{
|
||||
@ -181,7 +181,7 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
try
|
||||
{
|
||||
CancellationTokenSource.Cancel();
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -191,7 +191,7 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CancellationTokenSource.Cancel();
|
||||
_cancellationTokenSource.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,19 +12,19 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
public class LogManager : ILogManager
|
||||
{
|
||||
private readonly ILogRepository Logs;
|
||||
private readonly ITenantResolver TenantResolver;
|
||||
private readonly IConfigurationRoot Config;
|
||||
private readonly IUserPermissions UserPermissions;
|
||||
private readonly IHttpContextAccessor Accessor;
|
||||
private readonly ILogRepository _logs;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IConfigurationRoot _config;
|
||||
private readonly IUserPermissions _userPermissions;
|
||||
private readonly IHttpContextAccessor _accessor;
|
||||
|
||||
public LogManager(ILogRepository Logs, ITenantResolver TenantResolver, IConfigurationRoot Config, IUserPermissions UserPermissions, IHttpContextAccessor Accessor)
|
||||
{
|
||||
this.Logs = Logs;
|
||||
this.TenantResolver = TenantResolver;
|
||||
this.Config = Config;
|
||||
this.UserPermissions = UserPermissions;
|
||||
this.Accessor = Accessor;
|
||||
this._logs = Logs;
|
||||
this._tenantResolver = TenantResolver;
|
||||
this._config = Config;
|
||||
this._userPermissions = UserPermissions;
|
||||
this._accessor = Accessor;
|
||||
}
|
||||
|
||||
public void Log(LogLevel Level, object Class, LogFunction Function, string Message, params object[] Args)
|
||||
@ -48,7 +48,7 @@ namespace Oqtane.Infrastructure
|
||||
if (SiteId == -1)
|
||||
{
|
||||
log.SiteId = null;
|
||||
Alias alias = TenantResolver.GetAlias();
|
||||
Alias alias = _tenantResolver.GetAlias();
|
||||
if (alias != null)
|
||||
{
|
||||
log.SiteId = alias.SiteId;
|
||||
@ -61,12 +61,12 @@ namespace Oqtane.Infrastructure
|
||||
log.PageId = null;
|
||||
log.ModuleId = null;
|
||||
log.UserId = null;
|
||||
User user = UserPermissions.GetUser();
|
||||
User user = _userPermissions.GetUser();
|
||||
if (user != null)
|
||||
{
|
||||
log.UserId = user.UserId;
|
||||
}
|
||||
HttpRequest request = Accessor.HttpContext.Request;
|
||||
HttpRequest request = _accessor.HttpContext.Request;
|
||||
if (request != null)
|
||||
{
|
||||
log.Url = request.Scheme.ToString() + "://" + request.Host.ToString() + request.Path.ToString() + request.QueryString.ToString();
|
||||
@ -105,10 +105,10 @@ namespace Oqtane.Infrastructure
|
||||
public void Log(Log Log)
|
||||
{
|
||||
LogLevel minlevel = LogLevel.Information;
|
||||
var section = Config.GetSection("Logging:LogLevel:Default");
|
||||
var section = _config.GetSection("Logging:LogLevel:Default");
|
||||
if (section.Exists())
|
||||
{
|
||||
minlevel = Enum.Parse<LogLevel>(Config.GetSection("Logging:LogLevel:Default").ToString());
|
||||
minlevel = Enum.Parse<LogLevel>(_config.GetSection("Logging:LogLevel:Default").ToString());
|
||||
}
|
||||
|
||||
if (Enum.Parse<LogLevel>(Log.Level) >= minlevel)
|
||||
@ -119,7 +119,7 @@ namespace Oqtane.Infrastructure
|
||||
Log = ProcessStructuredLog(Log);
|
||||
try
|
||||
{
|
||||
Logs.AddLog(Log);
|
||||
_logs.AddLog(Log);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Reference in New Issue
Block a user