added HybridEnabled field to Site table to indicate if .NET MAUI hybrid applications can be integrated

This commit is contained in:
sbwalker
2023-12-04 16:35:03 -05:00
parent 08f691ee0d
commit 2e4656ae8b
6 changed files with 79 additions and 25 deletions

View File

@ -119,7 +119,7 @@ namespace Oqtane.Controllers
var assemblyList = new List<ClientAssembly>();
var site = _sites.GetSite(alias.SiteId);
if (site != null && site.Runtime == "WebAssembly")
if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled))
{
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
@ -201,7 +201,7 @@ namespace Oqtane.Controllers
private byte[] GetZIP(string list, Alias alias)
{
var site = _sites.GetSite(alias.SiteId);
if (site != null && site.Runtime == "WebAssembly")
if (site != null && (site.Runtime == "WebAssembly" || site.HybridEnabled))
{
var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

View File

@ -555,6 +555,7 @@ namespace Oqtane.Infrastructure
SiteTemplateType = install.SiteTemplate,
Runtime = (!string.IsNullOrEmpty(install.Runtime)) ? install.Runtime : _configManager.GetSection("Runtime").Value,
RenderMode = (!string.IsNullOrEmpty(install.RenderMode)) ? install.RenderMode : _configManager.GetSection("RenderMode").Value,
HybridEnabled = false
};
site = sites.AddSite(site);

View File

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Databases.Interfaces;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
namespace Oqtane.Migrations.Tenant
{
[DbContext(typeof(TenantDBContext))]
[Migration("Tenant.05.00.01.00")]
public class AddSiteHybridEnabled : MultiDatabaseMigration
{
public AddSiteHybridEnabled(IDatabase database) : base(database)
{
}
protected override void Up(MigrationBuilder migrationBuilder)
{
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
siteEntityBuilder.AddBooleanColumn("HybridEnabled", true);
siteEntityBuilder.UpdateColumn("HybridEnabled", "0", "bool", ""); // default to false
}
protected override void Down(MigrationBuilder migrationBuilder)
{
var siteEntityBuilder = new SiteEntityBuilder(migrationBuilder, ActiveDatabase);
siteEntityBuilder.DropColumn("HybridEnabled");
}
}
}