changed ServerAssemblyName to ServerManagerType to optimize processing

This commit is contained in:
Shaun Walker
2020-04-16 22:27:12 -04:00
parent f5e4c1dd29
commit b9d70dd11a
12 changed files with 69 additions and 79 deletions

View File

@ -670,21 +670,13 @@ namespace Oqtane.Repository
};
module = _moduleRepository.AddModule(module);
if (pagetemplatemodule.Content != "" && moduledefinition.ServerAssemblyName != "")
if (pagetemplatemodule.Content != "" && moduledefinition.ServerManagerType!= "")
{
Assembly assembly = AppDomain.CurrentDomain.GetAssemblies()
.Where(item => item.FullName.StartsWith(moduledefinition.ServerAssemblyName)).FirstOrDefault();
if (assembly != null)
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null)
{
Type moduletype = assembly.GetTypes()
.Where(item => item.Namespace != null)
.Where(item => item.Namespace.StartsWith(moduledefinition.ModuleDefinitionName.Substring(0, moduledefinition.ModuleDefinitionName.IndexOf(","))))
.Where(item => item.GetInterfaces().Contains(typeof(IPortable))).FirstOrDefault();
if (moduletype != null)
{
var moduleobject = ActivatorUtilities.CreateInstance(_serviceProvider, moduletype);
var moduleobject = ActivatorUtilities.CreateInstance(_serviceProvider, moduletype);
((IPortable) moduleobject).ImportModule(module, pagetemplatemodule.Content, moduledefinition.Version);
}
}
}