performance optimizations to avoid use of reflection ( thanks to @chlupac for this suggestion )
This commit is contained in:
@ -213,8 +213,8 @@ namespace Oqtane.Repository
|
||||
if (moduletype != null)
|
||||
{
|
||||
// get property values from IModule
|
||||
var moduleobject = Activator.CreateInstance(moduletype);
|
||||
moduledefinition = (ModuleDefinition) moduletype.GetProperty("ModuleDefinition").GetValue(moduleobject);
|
||||
var moduleobject = Activator.CreateInstance(moduletype) as IModule;
|
||||
moduledefinition = moduleobject.ModuleDefinition;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,8 +261,8 @@ namespace Oqtane.Repository
|
||||
|
||||
moduledefinition = moduledefinitions[index];
|
||||
// actions
|
||||
var modulecontrolobject = Activator.CreateInstance(modulecontroltype);
|
||||
string actions = (string) modulecontroltype.GetProperty("Actions")?.GetValue(modulecontrolobject);
|
||||
var modulecontrolobject = Activator.CreateInstance(modulecontroltype) as IModuleControl;
|
||||
string actions = modulecontrolobject.Actions;
|
||||
if (!string.IsNullOrEmpty(actions))
|
||||
{
|
||||
foreach (string action in actions.Split(','))
|
||||
|
@ -66,8 +66,8 @@ namespace Oqtane.Repository
|
||||
.Where(item => item.GetInterfaces().Contains(typeof(ITheme))).FirstOrDefault();
|
||||
if (themetype != null)
|
||||
{
|
||||
var themeobject = Activator.CreateInstance(themetype);
|
||||
theme = (Theme)themetype.GetProperty("Theme").GetValue(themeobject);
|
||||
var themeobject = Activator.CreateInstance(themetype) as ITheme;
|
||||
theme = themeobject.Theme;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user