initialize the Owner name when using an Oqtane Application and creating new modules or themes

This commit is contained in:
sbwalker
2025-11-19 10:47:38 -05:00
parent db41bfe638
commit dafbae7237
2 changed files with 22 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
@namespace Oqtane.Modules.Admin.ModuleDefinitions @namespace Oqtane.Modules.Admin.ModuleDefinitions
@inherits ModuleBase @inherits ModuleBase
@using System.Text.RegularExpressions @using System.Text.RegularExpressions
@using System.Reflection
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IModuleDefinitionService ModuleDefinitionService @inject IModuleDefinitionService ModuleDefinitionService
@inject IModuleService ModuleService @inject IModuleService ModuleService
@@ -97,6 +98,16 @@
{ {
AddModuleMessage(Localizer["Info.Module.Development"], MessageType.Info); AddModuleMessage(Localizer["Info.Module.Development"], MessageType.Info);
} }
else
{
var entryAssemblyName = Assembly.GetEntryAssembly().GetName().Name;
if (entryAssemblyName.EndsWith(".Oqtane"))
{
// Oqtane Application assemblies end with .Server.Oqtane or .Client.Oqtane
string[] segments = entryAssemblyName.Split('.');
_owner = string.Join(".", segments, 0, segments.Length - 2);
}
}
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()

View File

@@ -1,6 +1,7 @@
@namespace Oqtane.Modules.Admin.Themes @namespace Oqtane.Modules.Admin.Themes
@inherits ModuleBase @inherits ModuleBase
@using System.Text.RegularExpressions @using System.Text.RegularExpressions
@using System.Reflection
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IThemeService ThemeService @inject IThemeService ThemeService
@inject IModuleService ModuleService @inject IModuleService ModuleService
@@ -88,6 +89,16 @@
{ {
AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info); AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info);
} }
else
{
var entryAssemblyName = Assembly.GetEntryAssembly().GetName().Name;
if (entryAssemblyName.EndsWith(".Oqtane"))
{
// Oqtane Application assemblies end with .Server.Oqtane or .Client.Oqtane
string[] segments = entryAssemblyName.Split('.');
_owner = string.Join(".", segments, 0, segments.Length - 2);
}
}
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()