Skip to content

Commit

Permalink
Merge pull request #4429 from sbwalker/dev
Browse files Browse the repository at this point in the history
remove hardcoded names when using GetInterface()
  • Loading branch information
sbwalker authored Jul 17, 2024
2 parents 98adc2e + 7ee6775 commit 3c435a8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Oqtane.Server/Controllers/ModuleDefinitionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void Delete(int id, int siteid)
{
try
{
if (moduletype.GetInterface("IInstallable") != null)
if (moduletype.GetInterface(nameof(IInstallable)) != null)
{
_tenantManager.SetTenant(tenant.TenantId);
var moduleobject = ActivatorUtilities.CreateInstance(_serviceProvider, moduletype);
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Server/Infrastructure/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private Installation MigrateModules(InstallConfig install)
{
try
{
if (moduleType.GetInterface("IInstallable") != null)
if (moduleType.GetInterface(nameof(IInstallable)) != null)
{
tenantManager.SetTenant(tenant.TenantId);
var moduleObject = ActivatorUtilities.CreateInstance(scope.ServiceProvider, moduleType) as IInstallable;
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Server/Pages/Sitemap.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public IActionResult OnGet()
if (moduleDefinition != null && moduleDefinition.ServerManagerType != "")
{
Type moduletype = Type.GetType(moduleDefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("ISitemap") != null)
if (moduletype != null && moduletype.GetInterface(nameof(ISitemap)) != null)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Server/Repository/ModuleDefinitionRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private List<ModuleDefinition> LoadModuleDefinitionsFromAssembly(List<ModuleDefi
if (!string.IsNullOrEmpty(moduledefinition.ServerManagerType))
{
Type servertype = Type.GetType(moduledefinition.ServerManagerType);
if (servertype != null && servertype.GetInterface("IPortable") != null)
if (servertype != null && servertype.GetInterface(nameof(IPortable)) != null)
{
moduledefinition.IsPortable = true;
}
Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Server/Repository/ModuleRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public string ExportModule(int moduleId)
if (moduledefinition.ServerManagerType != "")
{
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null)
if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{
try
{
Expand Down Expand Up @@ -152,7 +152,7 @@ public bool ImportModule(int moduleId, string content)
if (moduledefinition.ServerManagerType != "")
{
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null)
if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Server/Repository/SiteRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public void CreatePages(Site site, List<PageTemplate> pageTemplates, Alias alias
if (pageTemplateModule.Content != "" && moduleDefinition.ServerManagerType != "")
{
Type moduletype = Type.GetType(moduleDefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null)
if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{
try
{
Expand Down

0 comments on commit 3c435a8

Please sign in to comment.