From 282579fcf254d9d64b4a2dd848f44826cd9bebce Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Fri, 14 Aug 2020 12:44:37 -0400 Subject: [PATCH] resolve #526 remove pluralization from module creation templates --- .../Modules/Admin/ModuleCreator/Index.razor | 2 +- .../Controllers/ModuleDefinitionController.cs | 14 ++--- .../Infrastructure/DatabaseManager.cs | 56 +++++++++-------- .../Templates/External/Client/Edit.razor | 8 ++- .../Templates/External/Client/Index.razor | 34 +++++------ .../Templates/External/Client/ModuleInfo.cs | 4 +- .../Client/Services/I[Module]Service.cs | 12 ++-- .../Client/Services/[Module]Service.cs | 34 ++++------- .../Templates/External/Client/Settings.razor | 2 +- ....csproj => [Owner].[Module].Client.csproj} | 6 +- ...csproj => [Owner].[Module].Package.csproj} | 6 +- ...odule]s.nuspec => [Owner].[Module].nuspec} | 18 +++--- .../Templates/External/Package/debug.cmd | 14 ++--- .../Templates/External/Package/release.cmd | 2 +- .../Server/Controllers/[Module]Controller.cs | 32 +++++----- .../Server/Manager/[Module]Manager.cs | 29 ++++----- .../Server/Repository/I[Module]Repository.cs | 12 ++-- .../Server/Repository/[Module]Context.cs | 6 +- .../Server/Repository/[Module]Repository.cs | 14 ++--- ...s.1.0.0.sql => [Owner].[Module].1.0.0.sql} | 0 ...all.sql => [Owner].[Module].Uninstall.sql} | 0 ....csproj => [Owner].[Module].Server.csproj} | 10 +-- .../Module.css | 0 .../Module.js | 0 .../External/Shared/Models/[Module].cs | 2 +- ....csproj => [Owner].[Module].Shared.csproj} | 4 +- ...er].[Module]s.sln => [Owner].[Module].sln} | 8 +-- .../Edit.razor | 8 ++- .../Index.razor | 20 +++--- .../ModuleInfo.cs | 2 +- .../Services/I[Module]Service.cs | 19 ++++++ .../Services/[Module]Service.cs | 49 +++++++++++++++ .../Settings.razor | 2 +- .../Services/I[Module]Service.cs | 19 ------ .../Services/[Module]Service.cs | 61 ------------------- .../Controllers/[Module]Controller.cs | 32 +++++----- .../Manager/[Module]Manager.cs | 61 +++++++++++++++++++ .../Repository/I[Module]Repository.cs | 14 +++++ .../Repository/[Module]Context.cs | 6 +- .../Repository/[Module]Repository.cs | 14 ++--- .../Scripts/[Owner].[Module].1.0.0.sql} | 0 .../Scripts/[Owner].[Module].Uninstall.sql} | 0 .../Manager/[Module]Manager.cs | 52 ---------------- .../Repository/I[Module]Repository.cs | 14 ----- .../Module.css | 0 .../Module.js | 0 .../Models/[Module].cs | 2 +- 47 files changed, 346 insertions(+), 358 deletions(-) rename Oqtane.Server/wwwroot/Modules/Templates/External/Client/{[Owner].[Module]s.Client.csproj => [Owner].[Module].Client.csproj} (87%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Package/{[Owner].[Module]s.Package.csproj => [Owner].[Module].Package.csproj} (65%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Package/{[Owner].[Module]s.nuspec => [Owner].[Module].nuspec} (73%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/{[Owner].[Module]s.1.0.0.sql => [Owner].[Module].1.0.0.sql} (100%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/{[Owner].[Module]s.Uninstall.sql => [Owner].[Module].Uninstall.sql} (100%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Server/{[Owner].[Module]s.Server.csproj => [Owner].[Module].Server.csproj} (77%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/{[Owner].[Module]s => [Owner].[Module]}/Module.css (100%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/{[Owner].[Module]s => [Owner].[Module]}/Module.js (100%) rename Oqtane.Server/wwwroot/Modules/Templates/External/Shared/{[Owner].[Module]s.Shared.csproj => [Owner].[Module].Shared.csproj} (84%) rename Oqtane.Server/wwwroot/Modules/Templates/External/{[Owner].[Module]s.sln => [Owner].[Module].sln} (87%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/{[Owner].[Module]s => [Owner].[Module]}/Edit.razor (95%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/{[Owner].[Module]s => [Owner].[Module]}/Index.razor (88%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/{[Owner].[Module]s => [Owner].[Module]}/ModuleInfo.cs (93%) create mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/I[Module]Service.cs create mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/[Module]Service.cs rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/{[Owner].[Module]s => [Owner].[Module]}/Settings.razor (97%) delete mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/I[Module]Service.cs delete mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/[Module]Service.cs rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/{[Owner].[Module]s => [Owner].[Module]}/Controllers/[Module]Controller.cs (67%) create mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Manager/[Module]Manager.cs create mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/I[Module]Repository.cs rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/{[Owner].[Module]s => [Owner].[Module]}/Repository/[Module]Context.cs (74%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/{[Owner].[Module]s => [Owner].[Module]}/Repository/[Module]Repository.cs (69%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/{[Owner].[Module]s/Scripts/[Owner].[Module]s.1.0.0.sql => [Owner].[Module]/Scripts/[Owner].[Module].1.0.0.sql} (100%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/{[Owner].[Module]s/Scripts/[Owner].[Module]s.Uninstall.sql => [Owner].[Module]/Scripts/[Owner].[Module].Uninstall.sql} (100%) delete mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Manager/[Module]Manager.cs delete mode 100644 Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/I[Module]Repository.cs rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/{[Owner].[Module]s => [Owner].[Module]}/Module.css (100%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/{[Owner].[Module]s => [Owner].[Module]}/Module.js (100%) rename Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/{[Owner].[Module]s => [Owner].[Module]}/Models/[Module].cs (93%) diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor index 9d26615a..e42c394f 100644 --- a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor +++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor @@ -16,7 +16,7 @@ - + diff --git a/Oqtane.Server/Controllers/ModuleDefinitionController.cs b/Oqtane.Server/Controllers/ModuleDefinitionController.cs index 20b5ae50..f1b9379f 100644 --- a/Oqtane.Server/Controllers/ModuleDefinitionController.cs +++ b/Oqtane.Server/Controllers/ModuleDefinitionController.cs @@ -175,14 +175,14 @@ namespace Oqtane.Controllers if (moduleDefinition.Template == "internal") { rootPath = Utilities.PathCombine(rootFolder.FullName,Path.DirectorySeparatorChar.ToString()); - moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s, Oqtane.Client"; - moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, Oqtane.Server"; + moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + ", Oqtane.Client"; + moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + ".Manager." + moduleDefinition.Name + "Manager, Oqtane.Server"; } else { - rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s",Path.DirectorySeparatorChar.ToString()); - moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Client.Oqtane"; - moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Server.Oqtane"; + rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name,Path.DirectorySeparatorChar.ToString()); + moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + ", " + moduleDefinition.Owner + "." + moduleDefinition.Name + ".Client.Oqtane"; + moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + ".Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + ".Server.Oqtane"; } ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, rootFolder.Name, templatePath, moduleDefinition); @@ -196,8 +196,8 @@ namespace Oqtane.Controllers { // add embedded resources to project List resources = new List(); - resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name + "s", "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + "s.1.0.0.sql")); - resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name + "s", "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Uninstall.sql")); + resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name, "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + ".1.0.0.sql")); + resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name, "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + ".Uninstall.sql")); EmbedResourceFiles(Utilities.PathCombine(rootPath, "Oqtane.Server", "Oqtane.Server.csproj"), resources); } diff --git a/Oqtane.Server/Infrastructure/DatabaseManager.cs b/Oqtane.Server/Infrastructure/DatabaseManager.cs index 3ba6160b..6aa2369a 100644 --- a/Oqtane.Server/Infrastructure/DatabaseManager.cs +++ b/Oqtane.Server/Infrastructure/DatabaseManager.cs @@ -342,46 +342,48 @@ namespace Oqtane.Infrastructure if (!string.IsNullOrEmpty(moduledefinition.ReleaseVersions) && !string.IsNullOrEmpty(moduledefinition.ServerManagerType)) { Type moduletype = Type.GetType(moduledefinition.ServerManagerType); - - string[] versions = moduledefinition.ReleaseVersions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - using (var db = new InstallationContext(NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey)))) + if (moduletype != null) { - foreach (var tenant in db.Tenant.ToList()) + string[] versions = moduledefinition.ReleaseVersions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + using (var db = new InstallationContext(NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey)))) { - int index = Array.FindIndex(versions, item => item == moduledefinition.Version); - if (tenant.Name == install.TenantName && install.TenantName != Constants.MasterTenant) + foreach (var tenant in db.Tenant.ToList()) { - index = -1; - } - if (index != (versions.Length - 1)) - { - if (index == -1) index = 0; - for (int i = index; i < versions.Length; i++) + int index = Array.FindIndex(versions, item => item == moduledefinition.Version); + if (tenant.Name == install.TenantName && install.TenantName != Constants.MasterTenant) { - try + index = -1; + } + if (index != (versions.Length - 1)) + { + if (index == -1) index = 0; + for (int i = index; i < versions.Length; i++) { - if (moduletype.GetInterface("IInstallable") != null) + try { - var moduleobject = ActivatorUtilities.CreateInstance(scope.ServiceProvider, moduletype); + if (moduletype.GetInterface("IInstallable") != null) + { + var moduleobject = ActivatorUtilities.CreateInstance(scope.ServiceProvider, moduletype); ((IInstallable)moduleobject).Install(tenant, versions[i]); + } + else + { + sql.ExecuteScript(tenant, moduletype.Assembly, Utilities.GetTypeName(moduledefinition.ModuleDefinitionName) + "." + versions[i] + ".sql"); + } } - else + catch (Exception ex) { - sql.ExecuteScript(tenant, moduletype.Assembly, Utilities.GetTypeName(moduledefinition.ModuleDefinitionName) + "." + versions[i] + ".sql"); + result.Message = "An Error Occurred Installing " + moduledefinition.Name + " Version " + versions[i] + " - " + ex.Message.ToString(); } } - catch (Exception ex) - { - result.Message = "An Error Occurred Installing " + moduledefinition.Name + " Version " + versions[i] + " - " + ex.Message.ToString(); - } } } - } - if (string.IsNullOrEmpty(result.Message) && moduledefinition.Version != versions[versions.Length - 1]) - { - moduledefinition.Version = versions[versions.Length - 1]; - db.Entry(moduledefinition).State = EntityState.Modified; - db.SaveChanges(); + if (string.IsNullOrEmpty(result.Message) && moduledefinition.Version != versions[versions.Length - 1]) + { + moduledefinition.Version = versions[versions.Length - 1]; + db.Entry(moduledefinition).State = EntityState.Modified; + db.SaveChanges(); + } } } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor index 9da7cd0e..cd845092 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor @@ -1,8 +1,8 @@ @using Oqtane.Modules.Controls -@using [Owner].[Module]s.Services -@using [Owner].[Module]s.Models +@using [Owner].[Module].Services +@using [Owner].[Module].Models -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject I[Module]Service [Module]Service @inject NavigationManager NavigationManager @@ -31,6 +31,8 @@ public override string Actions => "Add,Edit"; + public override string Title => "Manage [Module]"; + public override List Resources => new List() { new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor index e00f0f90..2ac9f31c 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor @@ -1,7 +1,7 @@ -@using [Owner].[Module]s.Services -@using [Owner].[Module]s.Models +@using [Owner].[Module].Services +@using [Owner].[Module].Models -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject I[Module]Service [Module]Service @inject NavigationManager NavigationManager @@ -17,16 +17,16 @@ else
@if (@_[Module]s.Count != 0) { - +
-
[Module]s
+   +   + Name
-
- - - @context.Name -
+ + + @context.Name
} @@ -41,7 +41,7 @@ else
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:

[RootPath]Client\
-- [Owner].[Module]s.Client.csproj - client project
+- [Owner].[Module].Client.csproj - client project
- _Imports.razor - global imports for module components
- Edit.razor - component for adding or editing content
- Index.razor - main component for your module **the content you are reading is in this file**
@@ -50,22 +50,22 @@ else - Services\I[Module]Service.cs - interface for defining service API methods
- Services\[Module]Service.cs - implements service API interface methods

[RootPath]Package\
-- [Owner].[Module]s.nuspec - nuget manifest for packaging module
-- [Owner].[Module]s.Package.csproj - packaging project
+- [Owner].[Module].nuspec - nuget manifest for packaging module
+- [Owner].[Module].Package.csproj - packaging project
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode

[RootPath]Server\
-- [Owner].[Module]s.Server.csproj - server project
+- [Owner].[Module].Server.csproj - server project
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content
- Repository\I[Module]Repository.cs - interface for defining repository methods
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core
- Repository\[Module]Context.cs - provides a DB Context for data access
-- Scripts\[Owner].[Module]s.1.0.0.sql - database schema definition script
-- Scripts\[Owner].[Module]s.Uninstall.sql - database uninstall script
+- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script
+- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script
- wwwroot\Module.css - module style sheet

[RootPath]Shared\
-- [Owner].[Module]s.csproj - shared project
+- [Owner].[Module].csproj - shared project
- Models\[Module].cs - model definition

diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs index d6664487..af85489c 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs @@ -1,7 +1,7 @@ using Oqtane.Models; using Oqtane.Modules; -namespace [Owner].[Module]s +namespace [Owner].[Module] { public class ModuleInfo : IModule { @@ -12,7 +12,7 @@ namespace [Owner].[Module]s Version = "1.0.0", ServerManagerType = "[ServerManagerType]", ReleaseVersions = "1.0.0", - Dependencies = "[Owner].[Module]s.Shared.Oqtane" + Dependencies = "[Owner].[Module].Shared.Oqtane" }; } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs index 8e055608..601eba6a 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs @@ -1,18 +1,18 @@ using System.Collections.Generic; using System.Threading.Tasks; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Services +namespace [Owner].[Module].Services { public interface I[Module]Service { - Task> Get[Module]sAsync(int ModuleId); + Task> Get[Module]sAsync(int ModuleId); - Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId); + Task Get[Module]Async(int [Module]Id, int ModuleId); - Task<[Module]> Add[Module]Async([Module] [Module]); + Task Add[Module]Async(Models.[Module] [Module]); - Task<[Module]> Update[Module]Async([Module] [Module]); + Task Update[Module]Async(Models.[Module] [Module]); Task Delete[Module]Async(int [Module]Id, int ModuleId); } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs index 0ab2bf8d..05a85ac7 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs @@ -5,9 +5,9 @@ using System.Threading.Tasks; using Oqtane.Modules; using Oqtane.Services; using Oqtane.Shared; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Services +namespace [Owner].[Module].Services { public class [Module]Service : ServiceBase, I[Module]Service, IService { @@ -20,42 +20,30 @@ namespace [Owner].[Module]s.Services private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]"); - public async Task> Get[Module]sAsync(int ModuleId) + public async Task> Get[Module]sAsync(int ModuleId) { - List<[Module]> [Module]s = await GetJsonAsync>(CreateAuthPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId)); + List [Module]s = await GetJsonAsync>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId)); return [Module]s.OrderBy(item => item.Name).ToList(); } - public async Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId) + public async Task Get[Module]Async(int [Module]Id, int ModuleId) { - return await GetJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); + return await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); } - public async Task<[Module]> Add[Module]Async([Module] [Module]) + public async Task Add[Module]Async(Models.[Module] [Module]) { - return await PostJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]); + return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]); } - public async Task<[Module]> Update[Module]Async([Module] [Module]) + public async Task Update[Module]Async(Models.[Module] [Module]) { - return await PutJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]); + return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]); } public async Task Delete[Module]Async(int [Module]Id, int ModuleId) { - await DeleteAsync(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); - } - - private string CreateAuthPolicyUrl(string Url, int ModuleId) - { - if (Url.Contains("?")) - { - return Url + "&entityid=" + ModuleId.ToString(); - } - else - { - return Url + "?entityid=" + ModuleId.ToString(); - } + await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); } } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor index fac25c7e..415b24ca 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor @@ -1,4 +1,4 @@ -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject ISettingService SettingService diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module]s.Client.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj similarity index 87% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module]s.Client.csproj rename to Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj index db7be1c8..4cd92d84 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module]s.Client.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module].Client.csproj @@ -7,9 +7,9 @@ [Owner] [Owner] [Description] - [Owner].[Module]s + [Owner].[Module] [Owner] - [Owner].[Module]s.Client.Oqtane + [Owner].[Module].Client.Oqtane @@ -21,7 +21,7 @@ - + diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.Package.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].Package.csproj similarity index 65% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.Package.csproj rename to Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].Package.csproj index 31d02d8f..5f1dba1f 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.Package.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].Package.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.nuspec b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].nuspec similarity index 73% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.nuspec rename to Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].nuspec index 6fa789e8..9ed078c4 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.nuspec +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module].nuspec @@ -1,12 +1,12 @@  - [Owner].[Module]s + [Owner].[Module] 1.0.0 [Owner] [Owner] - [Module]s - [Module]s + [Module] + [Module] [Owner] false MIT @@ -20,12 +20,12 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd index 7ac65774..b9f4921e 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd @@ -1,7 +1,7 @@ -XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y -XCOPY "..\Server\wwwroot\Modules\[Owner].[Module]s\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\[Owner].[Module]s\" /Y /S /I +XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module].Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module].Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module].Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module].Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module].Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module].Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y +XCOPY "..\Server\wwwroot\Modules\[Owner].[Module]\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\[Owner].[Module]\" /Y /S /I diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd index b294ccdf..aaa25f5d 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd @@ -1,2 +1,2 @@ -"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.nuspec +"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module].nuspec XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs index 6045fddf..c8fe7485 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs @@ -5,21 +5,21 @@ using Microsoft.AspNetCore.Http; using Oqtane.Shared; using Oqtane.Enums; using Oqtane.Infrastructure; -using [Owner].[Module]s.Models; -using [Owner].[Module]s.Repository; +using [Owner].[Module].Models; +using [Owner].[Module].Repository; -namespace [Owner].[Module]s.Controllers +namespace [Owner].[Module].Controllers { [Route("{alias}/api/[controller]")] public class [Module]Controller : Controller { - private readonly I[Module]Repository _[Module]s; + private readonly I[Module]Repository _[Module]Repository; private readonly ILogManager _logger; protected int _entityId = -1; - public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger, IHttpContextAccessor accessor) + public [Module]Controller(I[Module]Repository [Module]Repository, ILogManager logger, IHttpContextAccessor accessor) { - _[Module]s = [Module]s; + _[Module]Repository = [Module]Repository; _logger = logger; if (accessor.HttpContext.Request.Query.ContainsKey("entityid")) @@ -31,17 +31,17 @@ namespace [Owner].[Module]s.Controllers // GET: api/?moduleid=x [HttpGet] [Authorize(Policy = "ViewModule")] - public IEnumerable<[Module]> Get(string moduleid) + public IEnumerable Get(string moduleid) { - return _[Module]s.Get[Module]s(int.Parse(moduleid)); + return _[Module]Repository.Get[Module]s(int.Parse(moduleid)); } // GET api//5 [HttpGet("{id}")] [Authorize(Policy = "ViewModule")] - public [Module] Get(int id) + public Models.[Module] Get(int id) { - [Module] [Module] = _[Module]s.Get[Module](id); + Models.[Module] [Module] = _[Module]Repository.Get[Module](id); if ([Module] != null && [Module].ModuleId != _entityId) { [Module] = null; @@ -52,11 +52,11 @@ namespace [Owner].[Module]s.Controllers // POST api/ [HttpPost] [Authorize(Policy = "EditModule")] - public [Module] Post([FromBody] [Module] [Module]) + public Models.[Module] Post([FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) { - [Module] = _[Module]s.Add[Module]([Module]); + [Module] = _[Module]Repository.Add[Module]([Module]); _logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]); } return [Module]; @@ -65,11 +65,11 @@ namespace [Owner].[Module]s.Controllers // PUT api//5 [HttpPut("{id}")] [Authorize(Policy = "EditModule")] - public [Module] Put(int id, [FromBody] [Module] [Module]) + public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) { - [Module] = _[Module]s.Update[Module]([Module]); + [Module] = _[Module]Repository.Update[Module]([Module]); _logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]); } return [Module]; @@ -80,10 +80,10 @@ namespace [Owner].[Module]s.Controllers [Authorize(Policy = "EditModule")] public void Delete(int id) { - [Module] [Module] = _[Module]s.Get[Module](id); + Models.[Module] [Module] = _[Module]Repository.Get[Module](id); if ([Module] != null && [Module].ModuleId == _entityId) { - _[Module]s.Delete[Module](id); + _[Module]Repository.Delete[Module](id); _logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id); } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs index 1fc55b78..486c8ddf 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs @@ -5,36 +5,36 @@ using Oqtane.Modules; using Oqtane.Models; using Oqtane.Infrastructure; using Oqtane.Repository; -using [Owner].[Module]s.Models; -using [Owner].[Module]s.Repository; +using [Owner].[Module].Models; +using [Owner].[Module].Repository; -namespace [Owner].[Module]s.Manager +namespace [Owner].[Module].Manager { public class [Module]Manager : IInstallable, IPortable { - private I[Module]Repository _[Module]s; + private I[Module]Repository _[Module]Repository; private ISqlRepository _sql; - public [Module]Manager(I[Module]Repository [Module]s, ISqlRepository sql) + public [Module]Manager(I[Module]Repository [Module]Repository, ISqlRepository sql) { - _[Module]s = [Module]s; + _[Module]Repository = [Module]Repository; _sql = sql; } public bool Install(Tenant tenant, string version) { - return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s." + version + ".sql"); + return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]." + version + ".sql"); } public bool Uninstall(Tenant tenant) { - return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s.Uninstall.sql"); + return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module].Uninstall.sql"); } public string ExportModule(Module module) { string content = ""; - List<[Module]> [Module]s = _[Module]s.Get[Module]s(module.ModuleId).ToList(); + List [Module]s = _[Module]Repository.Get[Module]s(module.ModuleId).ToList(); if ([Module]s != null) { content = JsonSerializer.Serialize([Module]s); @@ -44,19 +44,16 @@ namespace [Owner].[Module]s.Manager public void ImportModule(Module module, string content, string version) { - List<[Module]> [Module]s = null; + List [Module]s = null; if (!string.IsNullOrEmpty(content)) { - [Module]s = JsonSerializer.Deserialize>(content); + [Module]s = JsonSerializer.Deserialize>(content); } if ([Module]s != null) { - foreach([Module] [Module] in [Module]s) + foreach(var [Module] in [Module]s) { - [Module] _[Module] = new [Module](); - _[Module].ModuleId = module.ModuleId; - _[Module].Name = [Module].Name; - _[Module]s.Add[Module](_[Module]); + _[Module]Repository.Add[Module](new Models.[Module] { ModuleId = module.ModuleId, Name = [Module].Name }); } } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs index f38a60d5..52b7913a 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Repository +namespace [Owner].[Module].Repository { public interface I[Module]Repository { - IEnumerable<[Module]> Get[Module]s(int ModuleId); - [Module] Get[Module](int [Module]Id); - [Module] Add[Module]([Module] [Module]); - [Module] Update[Module]([Module] [Module]); + IEnumerable Get[Module]s(int ModuleId); + Models.[Module] Get[Module](int [Module]Id); + Models.[Module] Add[Module](Models.[Module] [Module]); + Models.[Module] Update[Module](Models.[Module] [Module]); void Delete[Module](int [Module]Id); } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs index 2a14bbf4..a10d7219 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs @@ -2,13 +2,13 @@ using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Http; using Oqtane.Modules; using Oqtane.Repository; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Repository +namespace [Owner].[Module].Repository { public class [Module]Context : DBContextBase, IService { - public virtual DbSet<[Module]> [Module] { get; set; } + public virtual DbSet [Module] { get; set; } public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor) { diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs index 9b83b239..9c8c3628 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs @@ -2,9 +2,9 @@ using Microsoft.EntityFrameworkCore; using System.Linq; using System.Collections.Generic; using Oqtane.Modules; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Repository +namespace [Owner].[Module].Repository { public class [Module]Repository : I[Module]Repository, IService { @@ -15,24 +15,24 @@ namespace [Owner].[Module]s.Repository _db = context; } - public IEnumerable<[Module]> Get[Module]s(int ModuleId) + public IEnumerable Get[Module]s(int ModuleId) { return _db.[Module].Where(item => item.ModuleId == ModuleId); } - public [Module] Get[Module](int [Module]Id) + public Models.[Module] Get[Module](int [Module]Id) { return _db.[Module].Find([Module]Id); } - public [Module] Add[Module]([Module] [Module]) + public Models.[Module] Add[Module](Models.[Module] [Module]) { _db.[Module].Add([Module]); _db.SaveChanges(); return [Module]; } - public [Module] Update[Module]([Module] [Module]) + public Models.[Module] Update[Module](Models.[Module] [Module]) { _db.Entry([Module]).State = EntityState.Modified; _db.SaveChanges(); @@ -41,7 +41,7 @@ namespace [Owner].[Module]s.Repository public void Delete[Module](int [Module]Id) { - [Module] [Module] = _db.[Module].Find([Module]Id); + Models.[Module] [Module] = _db.[Module].Find([Module]Id); _db.[Module].Remove([Module]); _db.SaveChanges(); } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.1.0.0.sql b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module].1.0.0.sql similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.1.0.0.sql rename to Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module].1.0.0.sql diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.Uninstall.sql b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module].Uninstall.sql similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.Uninstall.sql rename to Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module].Uninstall.sql diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module]s.Server.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj similarity index 77% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module]s.Server.csproj rename to Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj index 44ec919c..8d6f5b57 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module]s.Server.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj @@ -5,17 +5,17 @@ 7.3 true 1.0.0 - [Owner].[Module]s + [Owner].[Module] [Owner] [Owner] [Description] [Owner] - [Owner].[Module]s.Server.Oqtane + [Owner].[Module].Server.Oqtane - - + + @@ -27,7 +27,7 @@ - + diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]s/Module.css b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]/Module.css similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]s/Module.css rename to Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]/Module.css diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]s/Module.js b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]/Module.js similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]s/Module.js rename to Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Modules/[Owner].[Module]/Module.js diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs index 5a6d7896..94f73ffa 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs @@ -2,7 +2,7 @@ using System; using System.ComponentModel.DataAnnotations.Schema; using Oqtane.Models; -namespace [Owner].[Module]s.Models +namespace [Owner].[Module].Models { [Table("[Owner][Module]")] public class [Module] : IAuditable diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module]s.Shared.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj similarity index 84% rename from Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module]s.Shared.csproj rename to Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj index 0d042df3..0e62a189 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module]s.Shared.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module].Shared.csproj @@ -4,12 +4,12 @@ netstandard2.1 7.3 1.0.0 - [Owner].[Module]s + [Owner].[Module] [Owner] [Owner] [Description] [Owner] - [Owner].[Module]s.Shared.Oqtane + [Owner].[Module].Shared.Oqtane diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module]s.sln b/Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module].sln similarity index 87% rename from Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module]s.sln rename to Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module].sln index eb313e64..b06b40c0 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module]s.sln +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module].sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28621.142 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Client", "Client\[Owner].[Module]s.Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Client", "Client\[Owner].[Module].Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Server", "Server\[Owner].[Module]s.Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Server", "Server\[Owner].[Module].Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Shared", "Shared\[Owner].[Module]s.Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Shared", "Shared\[Owner].[Module].Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module]s.Package", "Package\[Owner].[Module]s.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module].Package", "Package\[Owner].[Module].Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Edit.razor b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Edit.razor similarity index 95% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Edit.razor rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Edit.razor index 9da7cd0e..cd845092 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Edit.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Edit.razor @@ -1,8 +1,8 @@ @using Oqtane.Modules.Controls -@using [Owner].[Module]s.Services -@using [Owner].[Module]s.Models +@using [Owner].[Module].Services +@using [Owner].[Module].Models -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject I[Module]Service [Module]Service @inject NavigationManager NavigationManager @@ -31,6 +31,8 @@ public override string Actions => "Add,Edit"; + public override string Title => "Manage [Module]"; + public override List Resources => new List() { new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Index.razor b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Index.razor similarity index 88% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Index.razor rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Index.razor index 4e70fadb..5f8f04e2 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Index.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Index.razor @@ -1,7 +1,7 @@ -@using [Owner].[Module]s.Services -@using [Owner].[Module]s.Models +@using [Owner].[Module].Services +@using [Owner].[Module].Models -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject I[Module]Service [Module]Service @inject NavigationManager NavigationManager @@ -17,16 +17,16 @@ else
@if (@_[Module]s.Count != 0) { - +
-
[Module]s
+   +   + Name
-
- - - @context.Name -
+ + + @context.Name
} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/ModuleInfo.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/ModuleInfo.cs similarity index 93% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/ModuleInfo.cs rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/ModuleInfo.cs index 17af8d41..6586d51d 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/ModuleInfo.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/ModuleInfo.cs @@ -1,7 +1,7 @@ using Oqtane.Models; using Oqtane.Modules; -namespace [Owner].[Module]s +namespace [Owner].[Module] { public class ModuleInfo : IModule { diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/I[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/I[Module]Service.cs new file mode 100644 index 00000000..601eba6a --- /dev/null +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/I[Module]Service.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using [Owner].[Module].Models; + +namespace [Owner].[Module].Services +{ + public interface I[Module]Service + { + Task> Get[Module]sAsync(int ModuleId); + + Task Get[Module]Async(int [Module]Id, int ModuleId); + + Task Add[Module]Async(Models.[Module] [Module]); + + Task Update[Module]Async(Models.[Module] [Module]); + + Task Delete[Module]Async(int [Module]Id, int ModuleId); + } +} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/[Module]Service.cs new file mode 100644 index 00000000..05a85ac7 --- /dev/null +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Services/[Module]Service.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using Oqtane.Modules; +using Oqtane.Services; +using Oqtane.Shared; +using [Owner].[Module].Models; + +namespace [Owner].[Module].Services +{ + public class [Module]Service : ServiceBase, I[Module]Service, IService + { + private readonly SiteState _siteState; + + public [Module]Service(HttpClient http, SiteState siteState) : base(http) + { + _siteState = siteState; + } + + private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]"); + + public async Task> Get[Module]sAsync(int ModuleId) + { + List [Module]s = await GetJsonAsync>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId)); + return [Module]s.OrderBy(item => item.Name).ToList(); + } + + public async Task Get[Module]Async(int [Module]Id, int ModuleId) + { + return await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); + } + + public async Task Add[Module]Async(Models.[Module] [Module]) + { + return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]); + } + + public async Task Update[Module]Async(Models.[Module] [Module]) + { + return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]); + } + + public async Task Delete[Module]Async(int [Module]Id, int ModuleId) + { + await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); + } + } +} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Settings.razor b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Settings.razor similarity index 97% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Settings.razor rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Settings.razor index fac25c7e..415b24ca 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Settings.razor +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]/Settings.razor @@ -1,4 +1,4 @@ -@namespace [Owner].[Module]s +@namespace [Owner].[Module] @inherits ModuleBase @inject ISettingService SettingService diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/I[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/I[Module]Service.cs deleted file mode 100644 index 8e055608..00000000 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/I[Module]Service.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using [Owner].[Module]s.Models; - -namespace [Owner].[Module]s.Services -{ - public interface I[Module]Service - { - Task> Get[Module]sAsync(int ModuleId); - - Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId); - - Task<[Module]> Add[Module]Async([Module] [Module]); - - Task<[Module]> Update[Module]Async([Module] [Module]); - - Task Delete[Module]Async(int [Module]Id, int ModuleId); - } -} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/[Module]Service.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/[Module]Service.cs deleted file mode 100644 index 5fe282e6..00000000 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Client/Modules/[Owner].[Module]s/Services/[Module]Service.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Threading.Tasks; -using Oqtane.Modules; -using Oqtane.Services; -using Oqtane.Shared; -using [Owner].[Module]s.Models; - -namespace [Owner].[Module]s.Services -{ - public class [Module]Service : ServiceBase, I[Module]Service, IService - { - private readonly SiteState _siteState; - - public [Module]Service(HttpClient http, SiteState siteState) : base(http) - { - _siteState = siteState; - } - - private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]"); - - public async Task> Get[Module]sAsync(int ModuleId) - { - List<[Module]> [Module]s = await GetJsonAsync>(CreateAuthPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId)); - return [Module]s.OrderBy(item => item.Name).ToList(); - } - - public async Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId) - { - return await GetJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); - } - - public async Task<[Module]> Add[Module]Async([Module] [Module]) - { - return await PostJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}?entityid={[Module].ModuleId}", [Module].ModuleId), [Module]); - } - - public async Task<[Module]> Update[Module]Async([Module] [Module]) - { - return await PutJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]); - } - - public async Task Delete[Module]Async(int [Module]Id, int ModuleId) - { - await DeleteAsync(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId)); - } - - private string CreateAuthPolicyUrl(string Url, int ModuleId) - { - if (Url.Contains("?")) - { - return Url + "&entityid=" + ModuleId.ToString(); - } - else - { - return Url + "?entityid=" + ModuleId.ToString(); - } - } - } -} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Controllers/[Module]Controller.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs similarity index 67% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Controllers/[Module]Controller.cs rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs index 6045fddf..c8fe7485 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Controllers/[Module]Controller.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs @@ -5,21 +5,21 @@ using Microsoft.AspNetCore.Http; using Oqtane.Shared; using Oqtane.Enums; using Oqtane.Infrastructure; -using [Owner].[Module]s.Models; -using [Owner].[Module]s.Repository; +using [Owner].[Module].Models; +using [Owner].[Module].Repository; -namespace [Owner].[Module]s.Controllers +namespace [Owner].[Module].Controllers { [Route("{alias}/api/[controller]")] public class [Module]Controller : Controller { - private readonly I[Module]Repository _[Module]s; + private readonly I[Module]Repository _[Module]Repository; private readonly ILogManager _logger; protected int _entityId = -1; - public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger, IHttpContextAccessor accessor) + public [Module]Controller(I[Module]Repository [Module]Repository, ILogManager logger, IHttpContextAccessor accessor) { - _[Module]s = [Module]s; + _[Module]Repository = [Module]Repository; _logger = logger; if (accessor.HttpContext.Request.Query.ContainsKey("entityid")) @@ -31,17 +31,17 @@ namespace [Owner].[Module]s.Controllers // GET: api/?moduleid=x [HttpGet] [Authorize(Policy = "ViewModule")] - public IEnumerable<[Module]> Get(string moduleid) + public IEnumerable Get(string moduleid) { - return _[Module]s.Get[Module]s(int.Parse(moduleid)); + return _[Module]Repository.Get[Module]s(int.Parse(moduleid)); } // GET api//5 [HttpGet("{id}")] [Authorize(Policy = "ViewModule")] - public [Module] Get(int id) + public Models.[Module] Get(int id) { - [Module] [Module] = _[Module]s.Get[Module](id); + Models.[Module] [Module] = _[Module]Repository.Get[Module](id); if ([Module] != null && [Module].ModuleId != _entityId) { [Module] = null; @@ -52,11 +52,11 @@ namespace [Owner].[Module]s.Controllers // POST api/ [HttpPost] [Authorize(Policy = "EditModule")] - public [Module] Post([FromBody] [Module] [Module]) + public Models.[Module] Post([FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) { - [Module] = _[Module]s.Add[Module]([Module]); + [Module] = _[Module]Repository.Add[Module]([Module]); _logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]); } return [Module]; @@ -65,11 +65,11 @@ namespace [Owner].[Module]s.Controllers // PUT api//5 [HttpPut("{id}")] [Authorize(Policy = "EditModule")] - public [Module] Put(int id, [FromBody] [Module] [Module]) + public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) { - [Module] = _[Module]s.Update[Module]([Module]); + [Module] = _[Module]Repository.Update[Module]([Module]); _logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]); } return [Module]; @@ -80,10 +80,10 @@ namespace [Owner].[Module]s.Controllers [Authorize(Policy = "EditModule")] public void Delete(int id) { - [Module] [Module] = _[Module]s.Get[Module](id); + Models.[Module] [Module] = _[Module]Repository.Get[Module](id); if ([Module] != null && [Module].ModuleId == _entityId) { - _[Module]s.Delete[Module](id); + _[Module]Repository.Delete[Module](id); _logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id); } } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Manager/[Module]Manager.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Manager/[Module]Manager.cs new file mode 100644 index 00000000..486c8ddf --- /dev/null +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Manager/[Module]Manager.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using Oqtane.Modules; +using Oqtane.Models; +using Oqtane.Infrastructure; +using Oqtane.Repository; +using [Owner].[Module].Models; +using [Owner].[Module].Repository; + +namespace [Owner].[Module].Manager +{ + public class [Module]Manager : IInstallable, IPortable + { + private I[Module]Repository _[Module]Repository; + private ISqlRepository _sql; + + public [Module]Manager(I[Module]Repository [Module]Repository, ISqlRepository sql) + { + _[Module]Repository = [Module]Repository; + _sql = sql; + } + + public bool Install(Tenant tenant, string version) + { + return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]." + version + ".sql"); + } + + public bool Uninstall(Tenant tenant) + { + return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module].Uninstall.sql"); + } + + public string ExportModule(Module module) + { + string content = ""; + List [Module]s = _[Module]Repository.Get[Module]s(module.ModuleId).ToList(); + if ([Module]s != null) + { + content = JsonSerializer.Serialize([Module]s); + } + return content; + } + + public void ImportModule(Module module, string content, string version) + { + List [Module]s = null; + if (!string.IsNullOrEmpty(content)) + { + [Module]s = JsonSerializer.Deserialize>(content); + } + if ([Module]s != null) + { + foreach(var [Module] in [Module]s) + { + _[Module]Repository.Add[Module](new Models.[Module] { ModuleId = module.ModuleId, Name = [Module].Name }); + } + } + } + } +} \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/I[Module]Repository.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/I[Module]Repository.cs new file mode 100644 index 00000000..52b7913a --- /dev/null +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/I[Module]Repository.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using [Owner].[Module].Models; + +namespace [Owner].[Module].Repository +{ + public interface I[Module]Repository + { + IEnumerable Get[Module]s(int ModuleId); + Models.[Module] Get[Module](int [Module]Id); + Models.[Module] Add[Module](Models.[Module] [Module]); + Models.[Module] Update[Module](Models.[Module] [Module]); + void Delete[Module](int [Module]Id); + } +} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Context.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Context.cs similarity index 74% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Context.cs rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Context.cs index 2a14bbf4..a10d7219 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Context.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Context.cs @@ -2,13 +2,13 @@ using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Http; using Oqtane.Modules; using Oqtane.Repository; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Repository +namespace [Owner].[Module].Repository { public class [Module]Context : DBContextBase, IService { - public virtual DbSet<[Module]> [Module] { get; set; } + public virtual DbSet [Module] { get; set; } public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor) { diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Repository.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Repository.cs similarity index 69% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Repository.cs rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Repository.cs index 9b83b239..9c8c3628 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/[Module]Repository.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Repository/[Module]Repository.cs @@ -2,9 +2,9 @@ using Microsoft.EntityFrameworkCore; using System.Linq; using System.Collections.Generic; using Oqtane.Modules; -using [Owner].[Module]s.Models; +using [Owner].[Module].Models; -namespace [Owner].[Module]s.Repository +namespace [Owner].[Module].Repository { public class [Module]Repository : I[Module]Repository, IService { @@ -15,24 +15,24 @@ namespace [Owner].[Module]s.Repository _db = context; } - public IEnumerable<[Module]> Get[Module]s(int ModuleId) + public IEnumerable Get[Module]s(int ModuleId) { return _db.[Module].Where(item => item.ModuleId == ModuleId); } - public [Module] Get[Module](int [Module]Id) + public Models.[Module] Get[Module](int [Module]Id) { return _db.[Module].Find([Module]Id); } - public [Module] Add[Module]([Module] [Module]) + public Models.[Module] Add[Module](Models.[Module] [Module]) { _db.[Module].Add([Module]); _db.SaveChanges(); return [Module]; } - public [Module] Update[Module]([Module] [Module]) + public Models.[Module] Update[Module](Models.[Module] [Module]) { _db.Entry([Module]).State = EntityState.Modified; _db.SaveChanges(); @@ -41,7 +41,7 @@ namespace [Owner].[Module]s.Repository public void Delete[Module](int [Module]Id) { - [Module] [Module] = _db.[Module].Find([Module]Id); + Models.[Module] [Module] = _db.[Module].Find([Module]Id); _db.[Module].Remove([Module]); _db.SaveChanges(); } diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Scripts/[Owner].[Module]s.1.0.0.sql b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Scripts/[Owner].[Module].1.0.0.sql similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Scripts/[Owner].[Module]s.1.0.0.sql rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Scripts/[Owner].[Module].1.0.0.sql diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Scripts/[Owner].[Module]s.Uninstall.sql b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Scripts/[Owner].[Module].Uninstall.sql similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Scripts/[Owner].[Module]s.Uninstall.sql rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Scripts/[Owner].[Module].Uninstall.sql diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Manager/[Module]Manager.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Manager/[Module]Manager.cs deleted file mode 100644 index ba4f667c..00000000 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Manager/[Module]Manager.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using Oqtane.Modules; -using Oqtane.Models; -using Oqtane.Infrastructure; -using Oqtane.Repository; -using [Owner].[Module]s.Models; -using [Owner].[Module]s.Repository; - -namespace [Owner].[Module]s.Manager -{ - public class [Module]Manager : IPortable - { - private I[Module]Repository _[Module]s; - - public [Module]Manager(I[Module]Repository [Module]s) - { - _[Module]s = [Module]s; - } - - public string ExportModule(Module module) - { - string content = ""; - List<[Module]> [Module]s = _[Module]s.Get[Module]s(module.ModuleId).ToList(); - if ([Module]s != null) - { - content = JsonSerializer.Serialize([Module]s); - } - return content; - } - - public void ImportModule(Module module, string content, string version) - { - List<[Module]> [Module]s = null; - if (!string.IsNullOrEmpty(content)) - { - [Module]s = JsonSerializer.Deserialize>(content); - } - if ([Module]s != null) - { - foreach([Module] [Module] in [Module]s) - { - [Module] _[Module] = new [Module](); - _[Module].ModuleId = module.ModuleId; - _[Module].Name = [Module].Name; - _[Module]s.Add[Module](_[Module]); - } - } - } - } -} \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/I[Module]Repository.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/I[Module]Repository.cs deleted file mode 100644 index f38a60d5..00000000 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]s/Repository/I[Module]Repository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using [Owner].[Module]s.Models; - -namespace [Owner].[Module]s.Repository -{ - public interface I[Module]Repository - { - IEnumerable<[Module]> Get[Module]s(int ModuleId); - [Module] Get[Module](int [Module]Id); - [Module] Add[Module]([Module] [Module]); - [Module] Update[Module]([Module] [Module]); - void Delete[Module](int [Module]Id); - } -} diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]s/Module.css b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]/Module.css similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]s/Module.css rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]/Module.css diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]s/Module.js b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]/Module.js similarity index 100% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]s/Module.js rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/wwwroot/Modules/[Owner].[Module]/Module.js diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]s/Models/[Module].cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]/Models/[Module].cs similarity index 93% rename from Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]s/Models/[Module].cs rename to Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]/Models/[Module].cs index 5a6d7896..94f73ffa 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]s/Models/[Module].cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Shared/Modules/[Owner].[Module]/Models/[Module].cs @@ -2,7 +2,7 @@ using System; using System.ComponentModel.DataAnnotations.Schema; using Oqtane.Models; -namespace [Owner].[Module]s.Models +namespace [Owner].[Module].Models { [Table("[Owner][Module]")] public class [Module] : IAuditable