fix #1628 - make DBContext Transient, modify Control Panel to use standard Bootstrap 5 offcanvas classes, add auto trimming to file logger, fix issue in File Repository related to populating Url on Add/Update.
This commit is contained in:
@ -35,8 +35,8 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
|
||||
public static IServiceCollection AddOqtaneDbContext(this IServiceCollection services)
|
||||
{
|
||||
services.AddDbContext<MasterDBContext>(options => { });
|
||||
services.AddDbContext<TenantDBContext>(options => { });
|
||||
services.AddDbContext<MasterDBContext>(options => { }, ServiceLifetime.Transient);
|
||||
services.AddDbContext<TenantDBContext>(options => { }, ServiceLifetime.Transient);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
@ -54,6 +54,12 @@ namespace Oqtane.Infrastructure
|
||||
|
||||
var filepath = Path.Combine(folder, "error.log");
|
||||
|
||||
// only retain an error log for the current day as it is intended for development purposes
|
||||
if (File.GetCreationTime(filepath).ToUniversalTime().Date < DateTime.UtcNow.Date && File.Exists(filepath))
|
||||
{
|
||||
File.Delete(filepath);
|
||||
}
|
||||
|
||||
var logentry = string.Format("{0} [{1}] {2} {3}", "[" + DateTimeOffset.UtcNow.ToString("yyyy-MM-dd HH:mm:ss+00:00") + "]", logLevel.ToString(), formatter(state, exception), exception != null ? exception.StackTrace : "");
|
||||
|
||||
try
|
||||
|
@ -42,6 +42,7 @@ namespace Oqtane.Repository
|
||||
{
|
||||
_db.File.Add(file);
|
||||
_db.SaveChanges();
|
||||
file.Folder = _folderRepository.GetFolder(file.FolderId);
|
||||
file.Url = GetFileUrl(file, _tenants.GetAlias());
|
||||
return file;
|
||||
}
|
||||
@ -50,6 +51,7 @@ namespace Oqtane.Repository
|
||||
{
|
||||
_db.Entry(file).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
file.Folder = _folderRepository.GetFolder(file.FolderId);
|
||||
file.Url = GetFileUrl(file, _tenants.GetAlias());
|
||||
return file;
|
||||
}
|
||||
|
Reference in New Issue
Block a user