module creator templates need to be in the server project in order to be distributed with application
This commit is contained in:
98
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor
vendored
Normal file
98
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Edit.razor
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
@using Oqtane.Modules.Controls
|
||||
@using [Owner].[Module]s.Services
|
||||
@using [Owner].[Module]s.Models
|
||||
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject I[Module]Service [Module]Service
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="_name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Save">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
@if (PageState.Action == "Edit")
|
||||
{
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||
|
||||
public override string Actions => "Add,Edit";
|
||||
|
||||
public override List<Resource> Resources => new List<Resource>()
|
||||
{
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
||||
};
|
||||
|
||||
int _id;
|
||||
string _name;
|
||||
string _createdby;
|
||||
DateTime _createdon;
|
||||
string _modifiedby;
|
||||
DateTime _modifiedon;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PageState.Action == "Edit")
|
||||
{
|
||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||
[Module] [Module] = await [Module]Service.Get[Module]Async(_id);
|
||||
if ([Module] != null)
|
||||
{
|
||||
_name = [Module].Name;
|
||||
_createdby = [Module].CreatedBy;
|
||||
_createdon = [Module].CreatedOn;
|
||||
_modifiedby = [Module].ModifiedBy;
|
||||
_modifiedon = [Module].ModifiedOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading [Module] {[Module]Id} {Error}", _id, ex.Message);
|
||||
AddModuleMessage("Error Loading [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PageState.Action == "Add")
|
||||
{
|
||||
[Module] [Module] = new [Module]();
|
||||
[Module].ModuleId = ModuleState.ModuleId;
|
||||
[Module].Name = _name;
|
||||
[Module] = await [Module]Service.Add[Module]Async([Module]);
|
||||
await logger.LogInformation("[Module] Added {[Module]}", [Module]);
|
||||
}
|
||||
else
|
||||
{
|
||||
[Module] [Module] = await [Module]Service.Get[Module]Async(_id);
|
||||
[Module].Name = _name;
|
||||
await [Module]Service.Update[Module]Async([Module]);
|
||||
await logger.LogInformation("[Module] Updated {[Module]}", [Module]);
|
||||
}
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving [Module] {Error}", ex.Message);
|
||||
AddModuleMessage("Error Saving [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
109
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor
vendored
Normal file
109
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Index.razor
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
@using [Owner].[Module]s.Services
|
||||
@using [Owner].[Module]s.Models
|
||||
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject I[Module]Service [Module]Service
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@if (_[Module]s == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add [Module]" />
|
||||
<br />
|
||||
<br />
|
||||
@if (@_[Module]s.Count != 0)
|
||||
{
|
||||
<Pager Items="@_[Module]s" Format="Grid">
|
||||
<Header>
|
||||
<div class="col"><strong>[Module]s</strong></div>
|
||||
</Header>
|
||||
<Row>
|
||||
<div class="col">
|
||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" />
|
||||
<ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" />
|
||||
@context.Name
|
||||
</div>
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>No [Module]s To Display</p>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- The content below is for informational purposes only and can be safely removed -->
|
||||
|
||||
<hr />
|
||||
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
|
||||
[RootPath]Client\<br />
|
||||
- [Owner].[Module]s.Client.csproj - client project<br />
|
||||
- _Imports.razor - global imports for module components<br />
|
||||
- Edit.razor - component for adding or editing content<br />
|
||||
- Index.razor - main component for your module **the content you are reading is in this file**<br />
|
||||
- ModuleInfo.cs - implements IModule interface to provide configuration settings for your module<br />
|
||||
- Settings.razor - component for managing module settings<br />
|
||||
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
||||
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
||||
[RootPath]Package\<br />
|
||||
- [Owner].[Module]s.nuspec - nuget manifest for packaging module<br />
|
||||
- [Owner].[Module]s.Package.csproj - packaging project<br />
|
||||
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
|
||||
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
|
||||
[RootPath]Server\<br />
|
||||
- [Owner].[Module]s.Server.csproj - server project<br />
|
||||
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
|
||||
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
|
||||
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
||||
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
|
||||
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
|
||||
- Scripts\[Owner].[Module]s.1.0.0.sql - database schema definition script<br />
|
||||
- Scripts\[Owner].[Module]s.Uninstall.sql - database uninstall script<br />
|
||||
- wwwroot\Module.css - module style sheet<br /><br />
|
||||
[RootPath]Shared\<br />
|
||||
- [Owner].[Module]s.csproj - shared project<br />
|
||||
- Models\[Module].cs - model definition<br /><br />
|
||||
|
||||
<!-- The content above is for informational purposes only and can be safely removed -->
|
||||
|
||||
@code {
|
||||
public override List<Resource> Resources => new List<Resource>()
|
||||
{
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
||||
};
|
||||
|
||||
List<[Module]> _[Module]s;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading [Module] {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Delete([Module] [Module])
|
||||
{
|
||||
try
|
||||
{
|
||||
await [Module]Service.Delete[Module]Async([Module].[Module]Id);
|
||||
await logger.LogInformation("[Module] Deleted {[Module]}", [Module]);
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting [Module] {[Module]} {Error}", [Module], ex.Message);
|
||||
AddModuleMessage("Error Deleting [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
17
Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs
vendored
Normal file
17
Oqtane.Server/wwwroot/Modules/Templates/External/Client/ModuleInfo.cs
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Modules;
|
||||
|
||||
namespace [Owner].[Module]s
|
||||
{
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
||||
Name = "[Module]",
|
||||
Description = "[Module]",
|
||||
Version = "1.0.0",
|
||||
ServerManagerType = "[ServerManagerType]",
|
||||
ReleaseVersions = "1.0.0"
|
||||
};
|
||||
}
|
||||
}
|
19
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs
vendored
Normal file
19
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/I[Module]Service.cs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Services
|
||||
{
|
||||
public interface I[Module]Service
|
||||
{
|
||||
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
|
||||
|
||||
Task<[Module]> Get[Module]Async(int [Module]Id);
|
||||
|
||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
||||
|
||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
||||
|
||||
Task Delete[Module]Async(int [Module]Id);
|
||||
}
|
||||
}
|
49
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs
vendored
Normal file
49
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Services/[Module]Service.cs
vendored
Normal file
@ -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]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<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
||||
{
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
||||
{
|
||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
|
||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task Delete[Module]Async(int [Module]Id)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
}
|
||||
}
|
47
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor
vendored
Normal file
47
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Settings.razor
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject ISettingService SettingService
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Setting" class="control-label">Setting: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="_value" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@code {
|
||||
public override string Title => "[Module] Settings";
|
||||
|
||||
string _value;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
_value = SettingService.GetSetting(settings, "SettingName", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
SettingService.SetSetting(settings, "SettingName", _value);
|
||||
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
42
Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module]s.Client.csproj
vendored
Normal file
42
Oqtane.Server/wwwroot/Modules/Templates/External/Client/[Owner].[Module]s.Client.csproj
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Client.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.4" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Oqtane.Client">
|
||||
<HintPath>..\..\[RootFolder]\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Oqtane.Shared">
|
||||
<HintPath>..\..\[RootFolder]\Oqtane.Client\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- there may be other elements here -->
|
||||
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
20
Oqtane.Server/wwwroot/Modules/Templates/External/Client/_Imports.razor
vendored
Normal file
20
Oqtane.Server/wwwroot/Modules/Templates/External/Client/_Imports.razor
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
@using System
|
||||
@using System.Linq
|
||||
@using System.Collections.Generic
|
||||
@using System.Net.Http
|
||||
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.JSInterop
|
||||
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Modules.Controls
|
||||
@using Oqtane.Providers
|
||||
@using Oqtane.Security
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Themes
|
||||
@using Oqtane.Themes.Controls
|
||||
@using Oqtane.UI
|
||||
@using Oqtane.Enums
|
19
Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.Package.csproj
vendored
Normal file
19
Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.Package.csproj
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Client\[Owner].[Module]s.Client.csproj" />
|
||||
<ProjectReference Include="..\Server\[Owner].[Module]s.Server.csproj" />
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="IF $(ConfigurationName) == Debug (debug.cmd)" />
|
||||
<Exec Command="IF $(ConfigurationName) == Release (release.cmd)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
32
Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.nuspec
vendored
Normal file
32
Oqtane.Server/wwwroot/Modules/Templates/External/Package/[Owner].[Module]s.nuspec
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>[Owner].[Module]s</id>
|
||||
<version>1.0.0</version>
|
||||
<authors>[Owner]</authors>
|
||||
<owners>[Owner]</owners>
|
||||
<title>[Module]s</title>
|
||||
<description>[Module]s</description>
|
||||
<copyright>[Owner]</copyright>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||
<tags>oqtane module</tags>
|
||||
<releaseNotes></releaseNotes>
|
||||
<summary></summary>
|
||||
<dependencies>
|
||||
<dependency id="Oqtane.Framework" version="[FrameworkVersion]" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" target="lib" />
|
||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" target="lib" />
|
||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" target="lib" />
|
||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" target="lib" />
|
||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" target="lib" />
|
||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" target="lib" />
|
||||
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
|
||||
<file src="..\Server\content\**\*.*" target="content" />
|
||||
</files>
|
||||
</package>
|
6
Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd
vendored
Normal file
6
Oqtane.Server/wwwroot/Modules/Templates/External/Package/debug.cmd
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
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
|
2
Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd
vendored
Normal file
2
Oqtane.Server/wwwroot/Modules/Templates/External/Package/release.cmd
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.nuspec
|
||||
XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y
|
75
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs
vendored
Normal file
75
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Controllers/[Module]Controller.cs
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.Infrastructure;
|
||||
using [Owner].[Module]s.Models;
|
||||
using [Owner].[Module]s.Repository;
|
||||
|
||||
namespace [Owner].[Module]s.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
public class [Module]Controller : Controller
|
||||
{
|
||||
private readonly I[Module]Repository _[Module]s;
|
||||
private readonly ILogManager _logger;
|
||||
|
||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger)
|
||||
{
|
||||
_[Module]s = [Module]s;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// GET: api/<controller>?moduleid=x
|
||||
[HttpGet]
|
||||
[Authorize(Roles = Constants.RegisteredRole)]
|
||||
public IEnumerable<[Module]> Get(string moduleid)
|
||||
{
|
||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
[Authorize(Roles = Constants.RegisteredRole)]
|
||||
public [Module] Get(int id)
|
||||
{
|
||||
return _[Module]s.Get[Module](id);
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public [Module] Post([FromBody] [Module] [Module])
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
[Module] = _[Module]s.Add[Module]([Module]);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
||||
}
|
||||
return [Module];
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
[Module] = _[Module]s.Update[Module]([Module]);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
||||
}
|
||||
return [Module];
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public void Delete(int id)
|
||||
{
|
||||
_[Module]s.Delete[Module](id);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
||||
}
|
||||
}
|
||||
}
|
64
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs
vendored
Normal file
64
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Manager/[Module]Manager.cs
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
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 : IInstallable, IPortable
|
||||
{
|
||||
private I[Module]Repository _[Module]s;
|
||||
private ISqlRepository _sql;
|
||||
|
||||
public [Module]Manager(I[Module]Repository [Module]s, ISqlRepository sql)
|
||||
{
|
||||
_[Module]s = [Module]s;
|
||||
_sql = sql;
|
||||
}
|
||||
|
||||
public bool Install(Tenant tenant, string version)
|
||||
{
|
||||
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s." + version + ".sql");
|
||||
}
|
||||
|
||||
public bool Uninstall(Tenant tenant)
|
||||
{
|
||||
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s.Uninstall.sql");
|
||||
}
|
||||
|
||||
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<List<[Module]>>(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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs
vendored
Normal file
14
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/I[Module]Repository.cs
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
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);
|
||||
}
|
||||
}
|
18
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs
vendored
Normal file
18
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Context.cs
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Oqtane.Modules;
|
||||
using Oqtane.Repository;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Repository
|
||||
{
|
||||
public class [Module]Context : DBContextBase, IService
|
||||
{
|
||||
public virtual DbSet<[Module]> [Module] { get; set; }
|
||||
|
||||
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
||||
{
|
||||
// ContextBase handles multi-tenant database connections
|
||||
}
|
||||
}
|
||||
}
|
49
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs
vendored
Normal file
49
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Repository/[Module]Repository.cs
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Modules;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Repository
|
||||
{
|
||||
public class [Module]Repository : I[Module]Repository, IService
|
||||
{
|
||||
private readonly [Module]Context _db;
|
||||
|
||||
public [Module]Repository([Module]Context context)
|
||||
{
|
||||
_db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<[Module]> Get[Module]s(int ModuleId)
|
||||
{
|
||||
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
||||
}
|
||||
|
||||
public [Module] Get[Module](int [Module]Id)
|
||||
{
|
||||
return _db.[Module].Find([Module]Id);
|
||||
}
|
||||
|
||||
public [Module] Add[Module]([Module] [Module])
|
||||
{
|
||||
_db.[Module].Add([Module]);
|
||||
_db.SaveChanges();
|
||||
return [Module];
|
||||
}
|
||||
|
||||
public [Module] Update[Module]([Module] [Module])
|
||||
{
|
||||
_db.Entry([Module]).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
return [Module];
|
||||
}
|
||||
|
||||
public void Delete[Module](int [Module]Id)
|
||||
{
|
||||
[Module] [Module] = _db.[Module].Find([Module]Id);
|
||||
_db.[Module].Remove([Module]);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
26
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.1.0.0.sql
vendored
Normal file
26
Oqtane.Server/wwwroot/Modules/Templates/External/Server/Scripts/[Owner].[Module]s.1.0.0.sql
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Create [Owner][Module] table
|
||||
*/
|
||||
|
||||
CREATE TABLE [dbo].[[Owner][Module]](
|
||||
[[Module]Id] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ModuleId] [int] NOT NULL,
|
||||
[Name] [nvarchar](256) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_[Owner][Module]] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[[Module]Id] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
/*
|
||||
Create foreign key relationships
|
||||
*/
|
||||
ALTER TABLE [dbo].[[Owner][Module]] WITH CHECK ADD CONSTRAINT [FK_[Owner][Module]_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].Module ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
@ -0,0 +1,6 @@
|
||||
/*
|
||||
Remove [Owner][Module] table
|
||||
*/
|
||||
|
||||
DROP TABLE [dbo].[[Owner][Module]]
|
||||
GO
|
42
Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module]s.Server.csproj
vendored
Normal file
42
Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module]s.Server.csproj
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<Version>1.0.0</Version>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Server.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\[Owner].[Module]s.1.0.0.sql" />
|
||||
<EmbeddedResource Include="Scripts\[Owner].[Module]s.Uninstall.sql" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Oqtane.Server">
|
||||
<HintPath>..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Oqtane.Shared">
|
||||
<HintPath>..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\Oqtane.Shared.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/content/resources.txt
vendored
Normal file
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/content/resources.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
This is the location where static resources for third party libraries should be located ( the third party library assemblies will be included in the /lib folder ). They should be placed in subfolders which match the naming convention of the third party library. When the module package is deployed the static resource subfolders will be extracted under the web root.
|
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Module.css
vendored
Normal file
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/Module.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
/* Module Custom Styles */
|
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/resources.txt
vendored
Normal file
1
Oqtane.Server/wwwroot/Modules/Templates/External/Server/wwwroot/resources.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
This is the location where static resources such as images, style sheets, or scripts for this module will be located. Static assets can be organized in subfolders. When the module package is deployed the assets will be extracted under the web root in a folder that matches the module namespace.
|
19
Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs
vendored
Normal file
19
Oqtane.Server/wwwroot/Modules/Templates/External/Shared/Models/[Module].cs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Models
|
||||
{
|
||||
[Table("[Owner][Module]")]
|
||||
public class [Module] : IAuditable
|
||||
{
|
||||
public int [Module]Id { get; set; }
|
||||
public int ModuleId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public string ModifiedBy { get; set; }
|
||||
public DateTime ModifiedOn { get; set; }
|
||||
}
|
||||
}
|
25
Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module]s.Shared.csproj
vendored
Normal file
25
Oqtane.Server/wwwroot/Modules/Templates/External/Shared/[Owner].[Module]s.Shared.csproj
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<Version>1.0.0</Version>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Shared.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Oqtane.Shared">
|
||||
<HintPath>..\..\[RootFolder]\Oqtane.Shared\bin\Debug\netstandard2.1\Oqtane.Shared.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
52
Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module]s.sln
vendored
Normal file
52
Oqtane.Server/wwwroot/Modules/Templates/External/[Owner].[Module]s.sln
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
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}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Server", "Server\[Owner].[Module]s.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}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module]s.Package", "Package\[Owner].[Module]s.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Wasm|Any CPU = Wasm|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Wasm|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Wasm|Any CPU.Build.0 = Release|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Wasm|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{04B05448-788F-433D-92C0-FED35122D45A}.Wasm|Any CPU.Build.0 = Release|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Wasm|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Wasm|Any CPU.Build.0 = Release|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Wasm|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Wasm|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1D016F15-46FE-4726-8DFD-2E4FD4DC7668}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -0,0 +1,92 @@
|
||||
@using Oqtane.Modules.Controls
|
||||
@using [Owner].[Module]s.Services
|
||||
@using [Owner].[Module]s.Models
|
||||
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject I[Module]Service [Module]Service
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="_name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Save">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
@if (PageState.Action == "Edit")
|
||||
{
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||
public override string Actions => "Add,Edit";
|
||||
|
||||
int _id;
|
||||
string _name;
|
||||
string _createdby;
|
||||
DateTime _createdon;
|
||||
string _modifiedby;
|
||||
DateTime _modifiedon;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PageState.Action == "Edit")
|
||||
{
|
||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||
[Module] [Module] = await [Module]Service.Get[Module]Async(_id);
|
||||
if ([Module] != null)
|
||||
{
|
||||
_name = [Module].Name;
|
||||
_createdby = [Module].CreatedBy;
|
||||
_createdon = [Module].CreatedOn;
|
||||
_modifiedby = [Module].ModifiedBy;
|
||||
_modifiedon = [Module].ModifiedOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading [Module] {[Module]Id} {Error}", _id, ex.Message);
|
||||
AddModuleMessage("Error Loading [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PageState.Action == "Add")
|
||||
{
|
||||
[Module] [Module] = new [Module]();
|
||||
[Module].ModuleId = ModuleState.ModuleId;
|
||||
[Module].Name = _name;
|
||||
[Module] = await [Module]Service.Add[Module]Async([Module]);
|
||||
await logger.LogInformation("[Module] Added {[Module]}", [Module]);
|
||||
}
|
||||
else
|
||||
{
|
||||
[Module] [Module] = await [Module]Service.Get[Module]Async(_id);
|
||||
[Module].Name = _name;
|
||||
await [Module]Service.Update[Module]Async([Module]);
|
||||
await logger.LogInformation("[Module] Updated {[Module]}", [Module]);
|
||||
}
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving [Module] {Error}", ex.Message);
|
||||
AddModuleMessage("Error Saving [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
@using [Owner].[Module]s.Services
|
||||
@using [Owner].[Module]s.Models
|
||||
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject I[Module]Service [Module]Service
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@if (_[Module]s == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add [Module]" />
|
||||
<br />
|
||||
<br />
|
||||
@if (@_[Module]s.Count != 0)
|
||||
{
|
||||
<Pager Items="@_[Module]s" Format="Grid">
|
||||
<Header>
|
||||
<div class="col"><strong>[Module]s</strong></div>
|
||||
</Header>
|
||||
<Row>
|
||||
<div class="col">
|
||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" />
|
||||
<ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" />
|
||||
@context.Name
|
||||
</div>
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>No [Module]s To Display</p>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- The content below is for informational purposes only and can be safely removed -->
|
||||
|
||||
<hr />
|
||||
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
|
||||
[RootPath]Oqtane.Client\Modules\[Module]\<br />
|
||||
- Edit.razor - component for adding or editing content<br />
|
||||
- Index.razor - main component for your module **the content you are reading is in this file**<br />
|
||||
- ModuleInfo.cs - implements IModule interface to provide configuration settings for your module<br />
|
||||
- Settings.razor - component for managing module settings<br />
|
||||
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
||||
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
||||
[RootPath]Oqtane.Server\Modules\[Module]\<br />
|
||||
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
|
||||
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
|
||||
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
||||
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
|
||||
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
|
||||
- Scripts\[Owner].[Module]s.1.0.0.sql - database schema definition script<br />
|
||||
- Scripts\[Owner].[Module]s.Uninstall.sql - database uninstall script<br /><br />
|
||||
[RootPath]Oqtane.Shared\Modules\[Module]\<br />
|
||||
- Models\[Module].cs - model definition<br /><br />
|
||||
|
||||
<!-- The content above is for informational purposes only and can be safely removed -->
|
||||
|
||||
@code {
|
||||
List<[Module]> _[Module]s;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading [Module] {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Delete([Module] [Module])
|
||||
{
|
||||
try
|
||||
{
|
||||
await [Module]Service.Delete[Module]Async([Module].[Module]Id);
|
||||
await logger.LogInformation("[Module] Deleted {[Module]}", [Module]);
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting [Module] {[Module]} {Error}", [Module], ex.Message);
|
||||
AddModuleMessage("Error Deleting [Module]", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Modules;
|
||||
|
||||
namespace [Owner].[Module]s
|
||||
{
|
||||
public class ModuleInfo : IModule
|
||||
{
|
||||
public ModuleDefinition ModuleDefinition => new ModuleDefinition
|
||||
{
|
||||
Name = "[Module]",
|
||||
Description = "[Module]",
|
||||
Version = "1.0.0",
|
||||
ServerManagerType = "[ServerManagerType]",
|
||||
ReleaseVersions = "1.0.0"
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Services
|
||||
{
|
||||
public interface I[Module]Service
|
||||
{
|
||||
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
|
||||
|
||||
Task<[Module]> Get[Module]Async(int [Module]Id);
|
||||
|
||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
||||
|
||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
||||
|
||||
Task Delete[Module]Async(int [Module]Id);
|
||||
}
|
||||
}
|
@ -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]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<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
||||
{
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
||||
{
|
||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
|
||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task Delete[Module]Async(int [Module]Id)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
@namespace [Owner].[Module]s
|
||||
@inherits ModuleBase
|
||||
@inject ISettingService SettingService
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Setting" class="control-label">Setting: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="_value" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@code {
|
||||
public override string Title => "[Module] Settings";
|
||||
|
||||
string _value;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
_value = SettingService.GetSetting(settings, "SettingName", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
SettingService.SetSetting(settings, "SettingName", _value);
|
||||
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.Infrastructure;
|
||||
using [Owner].[Module]s.Models;
|
||||
using [Owner].[Module]s.Repository;
|
||||
|
||||
namespace [Owner].[Module]s.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
public class [Module]Controller : Controller
|
||||
{
|
||||
private readonly I[Module]Repository _[Module]s;
|
||||
private readonly ILogManager _logger;
|
||||
|
||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger)
|
||||
{
|
||||
_[Module]s = [Module]s;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// GET: api/<controller>?moduleid=x
|
||||
[HttpGet]
|
||||
[Authorize(Roles = Constants.RegisteredRole)]
|
||||
public IEnumerable<[Module]> Get(string moduleid)
|
||||
{
|
||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
[Authorize(Roles = Constants.RegisteredRole)]
|
||||
public [Module] Get(int id)
|
||||
{
|
||||
return _[Module]s.Get[Module](id);
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public [Module] Post([FromBody] [Module] [Module])
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
[Module] = _[Module]s.Add[Module]([Module]);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
||||
}
|
||||
return [Module];
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
[Module] = _[Module]s.Update[Module]([Module]);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
||||
}
|
||||
return [Module];
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public void Delete(int id)
|
||||
{
|
||||
_[Module]s.Delete[Module](id);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
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<List<[Module]>>(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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Oqtane.Modules;
|
||||
using Oqtane.Repository;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Repository
|
||||
{
|
||||
public class [Module]Context : DBContextBase, IService
|
||||
{
|
||||
public virtual DbSet<[Module]> [Module] { get; set; }
|
||||
|
||||
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
||||
{
|
||||
// ContextBase handles multi-tenant database connections
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Modules;
|
||||
using [Owner].[Module]s.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Repository
|
||||
{
|
||||
public class [Module]Repository : I[Module]Repository, IService
|
||||
{
|
||||
private readonly [Module]Context _db;
|
||||
|
||||
public [Module]Repository([Module]Context context)
|
||||
{
|
||||
_db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<[Module]> Get[Module]s(int ModuleId)
|
||||
{
|
||||
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
||||
}
|
||||
|
||||
public [Module] Get[Module](int [Module]Id)
|
||||
{
|
||||
return _db.[Module].Find([Module]Id);
|
||||
}
|
||||
|
||||
public [Module] Add[Module]([Module] [Module])
|
||||
{
|
||||
_db.[Module].Add([Module]);
|
||||
_db.SaveChanges();
|
||||
return [Module];
|
||||
}
|
||||
|
||||
public [Module] Update[Module]([Module] [Module])
|
||||
{
|
||||
_db.Entry([Module]).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
return [Module];
|
||||
}
|
||||
|
||||
public void Delete[Module](int [Module]Id)
|
||||
{
|
||||
[Module] [Module] = _db.[Module].Find([Module]Id);
|
||||
_db.[Module].Remove([Module]);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Create [Owner][Module] table
|
||||
*/
|
||||
|
||||
CREATE TABLE [dbo].[[Owner][Module]](
|
||||
[[Module]Id] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ModuleId] [int] NOT NULL,
|
||||
[Name] [nvarchar](256) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_[Owner][Module]] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[[Module]Id] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
/*
|
||||
Create foreign key relationships
|
||||
*/
|
||||
ALTER TABLE [dbo].[[Owner][Module]] WITH CHECK ADD CONSTRAINT [FK_[Owner][Module]_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].Module ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
@ -0,0 +1,6 @@
|
||||
/*
|
||||
Remove [Owner][Module] table
|
||||
*/
|
||||
|
||||
DROP TABLE [dbo].[[Owner][Module]]
|
||||
GO
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace [Owner].[Module]s.Models
|
||||
{
|
||||
[Table("[Owner][Module]")]
|
||||
public class [Module] : IAuditable
|
||||
{
|
||||
public int [Module]Id { get; set; }
|
||||
public int ModuleId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public string CreatedBy { get; set; }
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public string ModifiedBy { get; set; }
|
||||
public DateTime ModifiedOn { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user