Solution of warning

"Calling 'BuildServiceProvider' from application code results in an additional copy of singleton services being created. Consider alternatives such as dependency injecting services as parameters to 'Configure'"
This commit is contained in:
Pavel Vesely
2020-04-12 10:49:43 +02:00
parent 68e200cb4c
commit 94cab7d4db
2 changed files with 21 additions and 12 deletions

View File

@ -25,13 +25,25 @@ namespace Oqtane.Infrastructure
}
public void InstallPackages(string folders, bool restart)
{
var webRootPath = _environment.WebRootPath;
var install = UnpackPackages(folders, webRootPath);
if (install && restart)
{
RestartApplication();
}
}
public static bool UnpackPackages(string folders, string webRootPath)
{
bool install = false;
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
foreach (string folder in folders.Split(','))
{
string sourceFolder = Path.Combine(_environment.WebRootPath, folder);
string sourceFolder = Path.Combine(webRootPath, folder);
// create folder if it does not exist
if (!Directory.Exists(sourceFolder))
@ -66,6 +78,7 @@ namespace Oqtane.Infrastructure
{
frameworkversion = node.Attributes["version"].Value;
}
reader.Close();
}
}
@ -95,22 +108,21 @@ namespace Oqtane.Infrastructure
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
entry.ExtractToFile(filename, true);
break;
}
}
}
}
// remove package
File.Delete(packagename);
install = true;
}
}
if (install && restart)
{
RestartApplication();
}
return install;
}
public void UpgradeFramework()