Performance improvements, refactoring of multi-tenant support, split Alias and Tenant entities for cleaner separation of concerns, create an additional site during installation for demonstratng multitenancy
This commit is contained in:
55
Oqtane.Server/Controllers/AliasController.cs
Normal file
55
Oqtane.Server/Controllers/AliasController.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
public class AliasController : Controller
|
||||
{
|
||||
private readonly IAliasRepository aliases;
|
||||
|
||||
public AliasController(IAliasRepository Aliases)
|
||||
{
|
||||
aliases = Aliases;
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
public IEnumerable<Alias> Get()
|
||||
{
|
||||
return aliases.GetAliases();
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
public Alias Get(int id)
|
||||
{
|
||||
return aliases.GetAlias(id);
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] Alias site)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
aliases.AddAlias(site);
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] Alias site)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
aliases.UpdateAlias(site);
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
aliases.DeleteAlias(id);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
@ -16,9 +17,39 @@ namespace Oqtane.Controllers
|
||||
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
public Tenant Get()
|
||||
public IEnumerable<Tenant> Get()
|
||||
{
|
||||
return tenants.GetTenant();
|
||||
return tenants.GetTenants();
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
public Tenant Get(int id)
|
||||
{
|
||||
return tenants.GetTenant(id);
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] Tenant site)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
tenants.AddTenant(site);
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] Tenant site)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
tenants.UpdateTenant(site);
|
||||
}
|
||||
|
||||
// DELETE api/<controller>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
tenants.DeleteTenant(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared.Modules.HtmlText.Models;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Modules;
|
||||
@ -10,7 +9,7 @@ namespace Oqtane.Server.Modules.HtmlText.Repository
|
||||
{
|
||||
public virtual DbSet<HtmlTextInfo> HtmlText { get; set; }
|
||||
|
||||
public HtmlTextContext(ITenantRepository TenantRepository):base(TenantRepository)
|
||||
public HtmlTextContext(ITenantResolver TenantResolver):base(TenantResolver)
|
||||
{
|
||||
// ContextBase handles multi-tenant database connections
|
||||
}
|
||||
|
91
Oqtane.Server/Repository/AliasRepository.cs
Normal file
91
Oqtane.Server/Repository/AliasRepository.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class AliasRepository : IAliasRepository
|
||||
{
|
||||
private HostContext db;
|
||||
private readonly IMemoryCache _cache;
|
||||
|
||||
public AliasRepository(HostContext context, IMemoryCache cache)
|
||||
{
|
||||
db = context;
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
public IEnumerable<Alias> GetAliases()
|
||||
{
|
||||
try
|
||||
{
|
||||
IEnumerable<Alias> aliases = _cache.GetOrCreate("aliases", entry =>
|
||||
{
|
||||
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
||||
return db.Alias.ToList();
|
||||
});
|
||||
return aliases;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAlias(Alias alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Alias.Add(alias);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAlias(Alias alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(alias).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Alias GetAlias(int aliasId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Alias alias = db.Alias.Find(aliasId);
|
||||
return alias;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAlias(int aliasId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Alias alias = db.Alias.Find(aliasId);
|
||||
db.Alias.Remove(alias);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -8,9 +8,9 @@ namespace Oqtane.Repository
|
||||
{
|
||||
private Tenant tenant;
|
||||
|
||||
public ContextBase(ITenantRepository TenantRepository)
|
||||
public ContextBase(ITenantResolver TenantResolver)
|
||||
{
|
||||
tenant = TenantRepository.GetTenant();
|
||||
tenant = TenantResolver.GetTenant();
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
@ -7,6 +7,7 @@ namespace Oqtane.Repository
|
||||
{
|
||||
public HostContext(DbContextOptions<HostContext> options) : base(options) { }
|
||||
|
||||
public virtual DbSet<Alias> Alias { get; set; }
|
||||
public virtual DbSet<Tenant> Tenant { get; set; }
|
||||
}
|
||||
}
|
||||
|
14
Oqtane.Server/Repository/IAliasRepository.cs
Normal file
14
Oqtane.Server/Repository/IAliasRepository.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface IAliasRepository
|
||||
{
|
||||
IEnumerable<Alias> GetAliases();
|
||||
void AddAlias(Alias alias);
|
||||
void UpdateAlias(Alias alias);
|
||||
Alias GetAlias(int aliasId);
|
||||
void DeleteAlias(int aliasId);
|
||||
}
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface ITenantRepository
|
||||
{
|
||||
Tenant GetTenant();
|
||||
IEnumerable<Tenant> GetTenants();
|
||||
void AddTenant(Tenant tenant);
|
||||
void UpdateTenant(Tenant tenant);
|
||||
Tenant GetTenant(int tenantId);
|
||||
void DeleteTenant(int tenantId);
|
||||
}
|
||||
}
|
||||
|
9
Oqtane.Server/Repository/ITenantResolver.cs
Normal file
9
Oqtane.Server/Repository/ITenantResolver.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface ITenantResolver
|
||||
{
|
||||
Tenant GetTenant();
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@ namespace Oqtane.Repository
|
||||
|
||||
private readonly Tenant tenant;
|
||||
|
||||
public TenantContext(ITenantRepository TenantRepository)
|
||||
public TenantContext(ITenantResolver TenantResolver)
|
||||
{
|
||||
tenant = TenantRepository.GetTenant();
|
||||
tenant = TenantResolver.GetTenant();
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Oqtane.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
@ -11,23 +12,14 @@ namespace Oqtane.Repository
|
||||
{
|
||||
private HostContext db;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly string alias;
|
||||
|
||||
public TenantRepository(HostContext context, IMemoryCache cache, IHttpContextAccessor accessor)
|
||||
public TenantRepository(HostContext context, IMemoryCache cache)
|
||||
{
|
||||
db = context;
|
||||
_cache = cache;
|
||||
|
||||
// get site alias based on request context
|
||||
alias = accessor.HttpContext.Request.Host.Value;
|
||||
string path = accessor.HttpContext.Request.Path.Value;
|
||||
if (path.StartsWith("/~") && !path.StartsWith("/~/"))
|
||||
{
|
||||
alias += path.Substring(0, path.IndexOf("/", 1));
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant GetTenant()
|
||||
public IEnumerable<Tenant> GetTenants()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -36,15 +28,45 @@ namespace Oqtane.Repository
|
||||
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
||||
return db.Tenant.ToList();
|
||||
});
|
||||
Tenant tenant;
|
||||
if (tenants.Count() == 1)
|
||||
{
|
||||
tenant = tenants.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
tenant = tenants.Where(item => item.Alias == alias).FirstOrDefault();
|
||||
}
|
||||
return tenants;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTenant(Tenant tenant)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Tenant.Add(tenant);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTenant(Tenant tenant)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(tenant).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant GetTenant(int tenantId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Tenant tenant = db.Tenant.Find(tenantId);
|
||||
return tenant;
|
||||
}
|
||||
catch
|
||||
@ -52,5 +74,19 @@ namespace Oqtane.Repository
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteTenant(int tenantId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Tenant tenant = db.Tenant.Find(tenantId);
|
||||
db.Tenant.Remove(tenant);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
48
Oqtane.Server/Repository/TenantResolver.cs
Normal file
48
Oqtane.Server/Repository/TenantResolver.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class TenantResolver : ITenantResolver
|
||||
{
|
||||
private HostContext db;
|
||||
private readonly string aliasname;
|
||||
private readonly IAliasRepository _aliasrepository;
|
||||
private readonly ITenantRepository _tenantrepository;
|
||||
|
||||
public TenantResolver(HostContext context, IHttpContextAccessor accessor, IAliasRepository aliasrepository, ITenantRepository tenantrepository)
|
||||
{
|
||||
db = context;
|
||||
_aliasrepository = aliasrepository;
|
||||
_tenantrepository = tenantrepository;
|
||||
|
||||
// get alias based on request context
|
||||
aliasname = accessor.HttpContext.Request.Host.Value;
|
||||
string path = accessor.HttpContext.Request.Path.Value;
|
||||
string[] segments = path.Split('/');
|
||||
if (segments[1] != "~")
|
||||
{
|
||||
aliasname += "/" + segments[1];
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant GetTenant()
|
||||
{
|
||||
try
|
||||
{
|
||||
IEnumerable<Alias> aliases = _aliasrepository.GetAliases(); // cached
|
||||
Alias alias = aliases.Where(item => item.Name == aliasname).FirstOrDefault();
|
||||
IEnumerable<Tenant> tenants = _tenantrepository.GetTenants(); // cached
|
||||
return tenants.Where(item => item.TenantId == alias.TenantId).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,12 +3,23 @@
|
||||
Create tables
|
||||
|
||||
*/
|
||||
CREATE TABLE [dbo].[Alias](
|
||||
[AliasId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [nvarchar](200) NOT NULL,
|
||||
[TenantId] [int] NOT NULL,
|
||||
[SiteId] [int] NOT NULL,
|
||||
CONSTRAINT [PK_Alias] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[AliasId] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Tenant](
|
||||
[TenantId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Alias] [nvarchar](200) NOT NULL,
|
||||
[Name] [nvarchar](100) NOT NULL,
|
||||
[DBConnectionString] [nvarchar](1024) NOT NULL,
|
||||
[DBSchema] [nvarchar](50) NOT NULL,
|
||||
[SiteId] [int] NOT NULL,
|
||||
[DBSchema] [nvarchar](50) NOT NULL
|
||||
CONSTRAINT [PK_Tenant] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[TenantId] ASC
|
||||
@ -102,7 +113,7 @@ GO
|
||||
|
||||
/*
|
||||
|
||||
Create relationships
|
||||
Create foreign key relationships
|
||||
|
||||
*/
|
||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
||||
@ -110,38 +121,28 @@ REFERENCES [dbo].[Module] ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[HtmlText] CHECK CONSTRAINT [FK_HtmlText_Module]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Module] WITH CHECK ADD CONSTRAINT [FK_Module_Site] FOREIGN KEY([SiteId])
|
||||
REFERENCES [dbo].[Site] ([SiteId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Module] CHECK CONSTRAINT [FK_Module_Site]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Page] WITH CHECK ADD CONSTRAINT [FK_Page_Site] FOREIGN KEY([SiteId])
|
||||
REFERENCES [dbo].[Site] ([SiteId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Page] CHECK CONSTRAINT [FK_Page_Site]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[PageModule] WITH CHECK ADD CONSTRAINT [FK_PageModule_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].[Module] ([ModuleId])
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[PageModule] CHECK CONSTRAINT [FK_PageModule_Module]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[PageModule] WITH CHECK ADD CONSTRAINT [FK_PageModule_Page] FOREIGN KEY([PageId])
|
||||
REFERENCES [dbo].[Page] ([PageId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[PageModule] CHECK CONSTRAINT [FK_PageModule_Page]
|
||||
ALTER TABLE [dbo].[Alias] WITH CHECK ADD CONSTRAINT [FK_Alias_Tenant] FOREIGN KEY([TenantId])
|
||||
REFERENCES [dbo].[Tenant] ([TenantId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
/*
|
||||
@ -151,17 +152,31 @@ Create seed data
|
||||
*/
|
||||
SET IDENTITY_INSERT [dbo].[Tenant] ON
|
||||
GO
|
||||
INSERT [dbo].[Tenant] ([TenantId], [Alias], [DBConnectionString], [DBSchema], [SiteId])
|
||||
VALUES (1, N'localhost:44357', N'{ConnectionString}', N'', 1)
|
||||
INSERT [dbo].[Tenant] ([TenantId], [Name], [DBConnectionString], [DBSchema])
|
||||
VALUES (1, N'Tenant1', N'{ConnectionString}', N'')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Tenant] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Alias] ON
|
||||
GO
|
||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId])
|
||||
VALUES (1, N'localhost:44357', 1, 1)
|
||||
GO
|
||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId])
|
||||
VALUES (2, N'localhost:44357/site2', 1, 2)
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Alias] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Site] ON
|
||||
GO
|
||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo])
|
||||
VALUES (1, N'Site1', N'oqtane.png')
|
||||
GO
|
||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo])
|
||||
VALUES (2, N'Site2', N'oqtane.png')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Site] OFF
|
||||
GO
|
||||
|
||||
@ -200,6 +215,12 @@ GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ViewPermissions], [EditPermissions], [ParentId], [Order], [IsNavigation], [LayoutType])
|
||||
VALUES (11, 1, N'Theme Management', N'admin/themes', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', N'Administrators', N'Administrators', 4, 4, 1, N'')
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ViewPermissions], [EditPermissions], [ParentId], [Order], [IsNavigation], [LayoutType])
|
||||
VALUES (12, 2, N'Page1', N'', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', N'All Users', N'Administrators', NULL, 1, 1, N'')
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ViewPermissions], [EditPermissions], [ParentId], [Order], [IsNavigation], [LayoutType])
|
||||
VALUES (13, 2, N'Page2', N'page2', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', N'All Users', N'Administrators', NULL, 1, 1, N'')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Page] OFF
|
||||
GO
|
||||
|
||||
@ -250,6 +271,12 @@ GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [ViewPermissions], [EditPermissions])
|
||||
VALUES (15, 1, N'Oqtane.Client.Modules.Admin.Themes, Oqtane.Client', N'Administrators', N'Administrators')
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [ViewPermissions], [EditPermissions])
|
||||
VALUES (16, 2, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', N'All Users', N'Administrators')
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [ViewPermissions], [EditPermissions])
|
||||
VALUES (17, 2, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', N'All Users', N'Administrators')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Module] OFF
|
||||
GO
|
||||
|
||||
@ -300,13 +327,19 @@ GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType])
|
||||
VALUES (15, 11, 15, N'Theme Management', N'Top', 0, N'Oqtane.Client.Themes.Theme2.Container2, Oqtane.Client')
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType])
|
||||
VALUES (16, 12, 16, N'Text', N'Top', 1, N'Oqtane.Client.Themes.Theme2.Container2, Oqtane.Client')
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType])
|
||||
VALUES (17, 13, 17, N'Text', N'Top', 1, N'Oqtane.Client.Themes.Theme2.Container2, Oqtane.Client')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[PageModule] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[HtmlText] ON
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content])
|
||||
VALUES (1, 3, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')
|
||||
VALUES (1, 3, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <br /><br /><a href="http://localhost:44357/site2/">Go To Site2</a>')
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content])
|
||||
VALUES (2, 5, N'Enim sed faucibus turpis in eu mi bibendum neque egestas. Quis hendrerit dolor magna eget est lorem. Dui faucibus in ornare quam viverra orci sagittis. Integer eget aliquet nibh praesent tristique magna sit. Nunc aliquet bibendum enim facilisis gravida neque convallis a cras. Tortor id aliquet lectus proin. Diam volutpat commodo sed egestas egestas fringilla. Posuere sollicitudin aliquam ultrices sagittis orci. Viverra mauris in aliquam sem fringilla ut morbi tincidunt. Eget gravida cum sociis natoque penatibus et. Sagittis orci a scelerisque purus semper. Eget velit aliquet sagittis id consectetur purus. Volutpat blandit aliquam etiam erat. Et tortor consequat id porta nibh venenatis cras. Volutpat odio facilisis mauris sit amet. Varius duis at consectetur lorem.')
|
||||
@ -317,6 +350,12 @@ GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content])
|
||||
VALUES (4, 7, N'Ornare arcu dui vivamus arcu felis bibendum ut. Tortor vitae purus faucibus ornare. Lectus sit amet est placerat in egestas erat imperdiet sed. Aliquam sem et tortor consequat id. Fermentum iaculis eu non diam phasellus vestibulum. Ultricies integer quis auctor elit sed. Fermentum odio eu feugiat pretium nibh ipsum. Ut consequat semper viverra nam libero. Blandit aliquam etiam erat velit scelerisque in dictum non consectetur. At risus viverra adipiscing at in tellus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue. At varius vel pharetra vel turpis nunc eget lorem dolor. Morbi non arcu risus quis varius. Turpis massa sed elementum tempus egestas.')
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content])
|
||||
VALUES (5, 16, N'Id consectetur purus ut faucibus pulvinar elementum integer. Bibendum neque egestas congue quisque egestas diam in arcu. Eget nullam non nisi est sit amet facilisis. Sit amet consectetur adipiscing elit pellentesque. Id aliquet risus feugiat in. Enim blandit volutpat maecenas volutpat blandit aliquam etiam erat. Commodo odio aenean sed adipiscing. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Aliquet enim tortor at auctor urna nunc. Nulla pellentesque dignissim enim sit amet. Suscipit adipiscing bibendum est ultricies integer quis auctor. Lacinia quis vel eros donec ac odio tempor. Aliquam vestibulum morbi blandit cursus risus at. <br /><br /><a href="http://localhost:44357/">Go To Site1</a>')
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content])
|
||||
VALUES (6, 17, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.')
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[HtmlText] OFF
|
||||
GO
|
||||
|
||||
|
@ -18,6 +18,7 @@ using Oqtane.Services;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Client;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Server
|
||||
{
|
||||
@ -57,11 +58,11 @@ namespace Oqtane.Server
|
||||
});
|
||||
}
|
||||
|
||||
// register singleton core services
|
||||
// register scoped core services
|
||||
services.AddScoped<SiteState>();
|
||||
services.AddScoped<IModuleDefinitionService, ModuleDefinitionService>();
|
||||
services.AddScoped<IThemeService, ThemeService>();
|
||||
|
||||
// register scoped core services
|
||||
services.AddScoped<IAliasService, AliasService>();
|
||||
services.AddScoped<ITenantService, TenantService>();
|
||||
services.AddScoped<ISiteService, SiteService>();
|
||||
services.AddScoped<IPageService, PageService>();
|
||||
@ -110,6 +111,8 @@ namespace Oqtane.Server
|
||||
services.AddSingleton<IThemeRepository, ThemeRepository>();
|
||||
|
||||
// register transient scoped core services
|
||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||
services.AddTransient<ITenantRepository, TenantRepository>();
|
||||
services.AddTransient<ISiteRepository, SiteRepository>();
|
||||
services.AddTransient<IPageRepository, PageRepository>();
|
||||
|
BIN
Oqtane.Server/wwwroot/Sites/2/oqtane.png
Normal file
BIN
Oqtane.Server/wwwroot/Sites/2/oqtane.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 5.3 KiB |
Reference in New Issue
Block a user