Merge pull request #4429 from sbwalker/dev

remove hardcoded names when using GetInterface()
This commit is contained in:
Shaun Walker 2024-07-17 19:53:06 -04:00 committed by GitHub
commit 3c435a804f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 7 deletions

View File

@ -194,7 +194,7 @@ namespace Oqtane.Controllers
{ {
try try
{ {
if (moduletype.GetInterface("IInstallable") != null) if (moduletype.GetInterface(nameof(IInstallable)) != null)
{ {
_tenantManager.SetTenant(tenant.TenantId); _tenantManager.SetTenant(tenant.TenantId);
var moduleobject = ActivatorUtilities.CreateInstance(_serviceProvider, moduletype); var moduleobject = ActivatorUtilities.CreateInstance(_serviceProvider, moduletype);

View File

@ -452,7 +452,7 @@ namespace Oqtane.Infrastructure
{ {
try try
{ {
if (moduleType.GetInterface("IInstallable") != null) if (moduleType.GetInterface(nameof(IInstallable)) != null)
{ {
tenantManager.SetTenant(tenant.TenantId); tenantManager.SetTenant(tenant.TenantId);
var moduleObject = ActivatorUtilities.CreateInstance(scope.ServiceProvider, moduleType) as IInstallable; var moduleObject = ActivatorUtilities.CreateInstance(scope.ServiceProvider, moduleType) as IInstallable;

View File

@ -73,7 +73,7 @@ namespace Oqtane.Pages
if (moduleDefinition != null && moduleDefinition.ServerManagerType != "") if (moduleDefinition != null && moduleDefinition.ServerManagerType != "")
{ {
Type moduletype = Type.GetType(moduleDefinition.ServerManagerType); Type moduletype = Type.GetType(moduleDefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("ISitemap") != null) if (moduletype != null && moduletype.GetInterface(nameof(ISitemap)) != null)
{ {
try try
{ {

View File

@ -340,7 +340,7 @@ namespace Oqtane.Repository
if (!string.IsNullOrEmpty(moduledefinition.ServerManagerType)) if (!string.IsNullOrEmpty(moduledefinition.ServerManagerType))
{ {
Type servertype = Type.GetType(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; moduledefinition.IsPortable = true;
} }

View File

@ -107,7 +107,7 @@ namespace Oqtane.Repository
if (moduledefinition.ServerManagerType != "") if (moduledefinition.ServerManagerType != "")
{ {
Type moduletype = Type.GetType(moduledefinition.ServerManagerType); Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null) if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{ {
try try
{ {
@ -152,7 +152,7 @@ namespace Oqtane.Repository
if (moduledefinition.ServerManagerType != "") if (moduledefinition.ServerManagerType != "")
{ {
Type moduletype = Type.GetType(moduledefinition.ServerManagerType); Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null) if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{ {
try try
{ {

View File

@ -542,7 +542,7 @@ namespace Oqtane.Repository
if (pageTemplateModule.Content != "" && moduleDefinition.ServerManagerType != "") if (pageTemplateModule.Content != "" && moduleDefinition.ServerManagerType != "")
{ {
Type moduletype = Type.GetType(moduleDefinition.ServerManagerType); Type moduletype = Type.GetType(moduleDefinition.ServerManagerType);
if (moduletype != null && moduletype.GetInterface("IPortable") != null) if (moduletype != null && moduletype.GetInterface(nameof(IPortable)) != null)
{ {
try try
{ {