Rename IOqtaneDatabase interface (and related base class)
This commit is contained in:
parent
791e786db8
commit
4a609b444e
|
@ -1,5 +1,6 @@
|
|||
using System.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
@ -9,7 +10,7 @@ using Oqtane.Shared;
|
|||
|
||||
namespace Oqtane.Database.MySQL
|
||||
{
|
||||
public class MySQLDatabase : OqtaneDatabaseBase
|
||||
public class MySQLDatabase : DatabaseBase
|
||||
{
|
||||
private static string _friendlyName => "MySQL";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Data;
|
|||
using System.Globalization;
|
||||
using EFCore.NamingConventions.Internal;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Npgsql;
|
||||
|
@ -12,7 +13,7 @@ using Oqtane.Shared;
|
|||
|
||||
namespace Oqtane.Database.PostgreSQL
|
||||
{
|
||||
public class PostgreSQLDatabase : OqtaneDatabaseBase
|
||||
public class PostgreSQLDatabase : DatabaseBase
|
||||
{
|
||||
private static string _friendlyName => "PostgreSQL";
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Data;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Oqtane.Databases;
|
||||
|
@ -9,7 +10,7 @@ using Oqtane.Shared;
|
|||
|
||||
namespace Oqtane.Database.SqlServer
|
||||
{
|
||||
public abstract class SqlServerDatabaseBase : OqtaneDatabaseBase
|
||||
public abstract class SqlServerDatabaseBase : DatabaseBase
|
||||
{
|
||||
protected SqlServerDatabaseBase(string name, string friendlyName) : base(name, friendlyName)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Data;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Oqtane.Databases;
|
||||
|
@ -9,7 +10,7 @@ using Oqtane.Shared;
|
|||
|
||||
namespace Oqtane.Database.Sqlite
|
||||
{
|
||||
public class SqliteDatabase : OqtaneDatabaseBase
|
||||
public class SqliteDatabase : DatabaseBase
|
||||
{
|
||||
private static string _friendlyName => "Sqlite";
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ using Oqtane.Databases.Interfaces;
|
|||
|
||||
namespace Oqtane.Databases
|
||||
{
|
||||
public abstract class OqtaneDatabaseBase : IOqtaneDatabase
|
||||
public abstract class DatabaseBase : IDatabase
|
||||
{
|
||||
private static string _assemblyName;
|
||||
|
||||
private static string _typeName;
|
||||
|
||||
protected OqtaneDatabaseBase(string name, string friendlyName)
|
||||
protected DatabaseBase(string name, string friendlyName)
|
||||
{
|
||||
Name = name;
|
||||
FriendlyName = friendlyName;
|
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
|||
|
||||
namespace Oqtane.Databases.Interfaces
|
||||
{
|
||||
public interface IOqtaneDatabase
|
||||
public interface IDatabase
|
||||
{
|
||||
public string AssemblyName { get; }
|
||||
|
|
@ -6,6 +6,6 @@ namespace Oqtane.Repository.Databases.Interfaces
|
|||
{
|
||||
public interface IMultiDatabase
|
||||
{
|
||||
public IOqtaneDatabase ActiveDatabase { get; }
|
||||
public IDatabase ActiveDatabase { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Oqtane.Extensions
|
|||
{
|
||||
public static class DbContextOptionsBuilderExtensions
|
||||
{
|
||||
public static DbContextOptionsBuilder UseOqtaneDatabase([NotNull] this DbContextOptionsBuilder optionsBuilder, IOqtaneDatabase database, string connectionString)
|
||||
public static DbContextOptionsBuilder UseOqtaneDatabase([NotNull] this DbContextOptionsBuilder optionsBuilder, IDatabase database, string connectionString)
|
||||
{
|
||||
database.UseDatabase(optionsBuilder, connectionString);
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace Oqtane.Infrastructure
|
|||
}
|
||||
|
||||
//Create database object from Type
|
||||
var database = Activator.CreateInstance(type) as IOqtaneDatabase;
|
||||
var database = Activator.CreateInstance(type) as IDatabase;
|
||||
|
||||
//create data directory if does not exist
|
||||
var dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory")?.ToString();
|
||||
|
@ -649,11 +649,11 @@ namespace Oqtane.Infrastructure
|
|||
var connectionString = _config.GetConnectionString(SettingKeys.ConnectionStringKey);
|
||||
var databaseType = _config.GetSection(SettingKeys.DatabaseSection)[SettingKeys.DatabaseTypeKey];
|
||||
|
||||
IOqtaneDatabase database = null;
|
||||
IDatabase database = null;
|
||||
if (!string.IsNullOrEmpty(databaseType))
|
||||
{
|
||||
var type = Type.GetType(databaseType);
|
||||
database = Activator.CreateInstance(type) as IOqtaneDatabase;
|
||||
database = Activator.CreateInstance(type) as IDatabase;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Master.01.00.00.00")]
|
||||
public class InitializeMaster : MultiDatabaseMigration
|
||||
{
|
||||
public InitializeMaster(IOqtaneDatabase database) : base(database)
|
||||
public InitializeMaster(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.01.00.00.00")]
|
||||
public class InitializeTenant : MultiDatabaseMigration
|
||||
{
|
||||
public InitializeTenant(IOqtaneDatabase database) : base(database)
|
||||
public InitializeTenant(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Master.01.00.01.00")]
|
||||
public class AddAdditionalIndexesInMaster : MultiDatabaseMigration
|
||||
{
|
||||
public AddAdditionalIndexesInMaster(IOqtaneDatabase database) : base(database)
|
||||
public AddAdditionalIndexesInMaster(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.01.00.01.00")]
|
||||
public class AddAdditionalIndexesInTenant : MultiDatabaseMigration
|
||||
{
|
||||
public AddAdditionalIndexesInTenant(IOqtaneDatabase database) : base(database)
|
||||
public AddAdditionalIndexesInTenant(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.01.00.01.01")]
|
||||
public class AddAdditionColumnToNotifications : MultiDatabaseMigration
|
||||
{
|
||||
public AddAdditionColumnToNotifications(IOqtaneDatabase database) : base(database)
|
||||
public AddAdditionColumnToNotifications(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.01.00.02.01")]
|
||||
public class DropColumnFromPage : MultiDatabaseMigration
|
||||
{
|
||||
public DropColumnFromPage(IOqtaneDatabase database) : base(database)
|
||||
public DropColumnFromPage(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.00.01")]
|
||||
public class AddColumnToProfileAndUpdatePage : MultiDatabaseMigration
|
||||
{
|
||||
public AddColumnToProfileAndUpdatePage(IOqtaneDatabase database) : base(database)
|
||||
public AddColumnToProfileAndUpdatePage(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.01.01")]
|
||||
public class UpdateIconColumnInPage : MultiDatabaseMigration
|
||||
{
|
||||
public UpdateIconColumnInPage(IOqtaneDatabase database) : base(database)
|
||||
public UpdateIconColumnInPage(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.01.02")]
|
||||
public class AddLanguageTable : MultiDatabaseMigration
|
||||
{
|
||||
public AddLanguageTable(IOqtaneDatabase database) : base(database)
|
||||
public AddLanguageTable(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.01.03")]
|
||||
public class UpdatePageAndAddColumnToSite : MultiDatabaseMigration
|
||||
{
|
||||
public UpdatePageAndAddColumnToSite(IOqtaneDatabase database) : base(database)
|
||||
public UpdatePageAndAddColumnToSite(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Oqtane.Migrations
|
|||
|
||||
public class AddSiteGuidToSite : MultiDatabaseMigration
|
||||
{
|
||||
public AddSiteGuidToSite(IOqtaneDatabase database) : base(database)
|
||||
public AddSiteGuidToSite(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.02.02")]
|
||||
public class UpdateDefaultContainerTypeInSitePage : MultiDatabaseMigration
|
||||
{
|
||||
public UpdateDefaultContainerTypeInSitePage(IOqtaneDatabase database) : base(database)
|
||||
public UpdateDefaultContainerTypeInSitePage(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.00.02.03")]
|
||||
public class DropDefaultLayoutInSite : MultiDatabaseMigration
|
||||
{
|
||||
public DropDefaultLayoutInSite(IOqtaneDatabase database) : base(database)
|
||||
public DropDefaultLayoutInSite(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.01.00.00")]
|
||||
public class AddAppVersionsTable : MultiDatabaseMigration
|
||||
{
|
||||
public AddAppVersionsTable(IOqtaneDatabase database) : base(database)
|
||||
public AddAppVersionsTable(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Master.02.01.00.00")]
|
||||
public class AddIndexesForForeignKeyInMaster : MultiDatabaseMigration
|
||||
{
|
||||
public AddIndexesForForeignKeyInMaster(IOqtaneDatabase database) : base(database)
|
||||
public AddIndexesForForeignKeyInMaster(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Master.02.01.00.01")]
|
||||
public class AddDatabaseTypeColumnToTenant : MultiDatabaseMigration
|
||||
{
|
||||
public AddDatabaseTypeColumnToTenant(IOqtaneDatabase database) : base(database)
|
||||
public AddDatabaseTypeColumnToTenant(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Oqtane.Migrations
|
|||
[Migration("Tenant.02.01.00.02")]
|
||||
public class ChangeFolderNameAndPathColumnsSize : MultiDatabaseMigration
|
||||
{
|
||||
public ChangeFolderNameAndPathColumnsSize(IOqtaneDatabase database) : base(database)
|
||||
public ChangeFolderNameAndPathColumnsSize(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<AliasEntityBuilder> _primaryKey = new("PK_Alias", x => x.AliasId);
|
||||
private readonly ForeignKey<AliasEntityBuilder> _tenantForeignKey = new("FK_Alias_Tenant", x => x.TenantId, "Tenant", "TenantId", ReferentialAction.Cascade);
|
||||
|
||||
public AliasEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public AliasEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "AppVersions";
|
||||
private readonly PrimaryKey<AppVersionsEntityBuilder> _primaryKey = new("PK_AppVersions", x => x.Id);
|
||||
|
||||
public AppVersionsEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public AppVersionsEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<AspNetUserClaimsEntityBuilder> _primaryKey = new("PK_AspNetUserClaims", x => x.Id);
|
||||
private readonly ForeignKey<AspNetUserClaimsEntityBuilder> _aspNetUsersForeignKey = new("FK_AspNetUserClaims_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id", ReferentialAction.Cascade);
|
||||
|
||||
public AspNetUserClaimsEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public AspNetUserClaimsEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "AspNetUsers";
|
||||
private readonly PrimaryKey<AspNetUsersEntityBuilder> _primaryKey = new("PK_AspNetUsers", x => x.Id);
|
||||
|
||||
public AspNetUsersEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public AspNetUsersEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
{
|
||||
public abstract class AuditableBaseEntityBuilder<TEntityBuilder> : BaseEntityBuilder<TEntityBuilder> where TEntityBuilder : BaseEntityBuilder<TEntityBuilder>
|
||||
{
|
||||
protected AuditableBaseEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base (migrationBuilder, database)
|
||||
protected AuditableBaseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base (migrationBuilder, database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,14 +14,14 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
{
|
||||
private readonly MigrationBuilder _migrationBuilder;
|
||||
|
||||
protected BaseEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database)
|
||||
protected BaseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database)
|
||||
{
|
||||
_migrationBuilder = migrationBuilder;
|
||||
ActiveDatabase = database;
|
||||
ForeignKeys = new List<ForeignKey<TEntityBuilder>>();
|
||||
}
|
||||
|
||||
protected IOqtaneDatabase ActiveDatabase { get; }
|
||||
protected IDatabase ActiveDatabase { get; }
|
||||
|
||||
protected abstract TEntityBuilder BuildTable(ColumnsBuilder table);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
{
|
||||
public abstract class DeletableAuditableBaseEntityBuilder<TEntityBuilder> : AuditableBaseEntityBuilder<TEntityBuilder> where TEntityBuilder : BaseEntityBuilder<TEntityBuilder>
|
||||
{
|
||||
protected DeletableAuditableBaseEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
protected DeletableAuditableBaseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
{
|
||||
public abstract class DeletableBaseEntityBuilder<TEntityBuilder> : BaseEntityBuilder<TEntityBuilder> where TEntityBuilder : BaseEntityBuilder<TEntityBuilder>
|
||||
{
|
||||
protected DeletableBaseEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
protected DeletableBaseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<FileEntityBuilder> _primaryKey = new("PK_File", x => x.FileId);
|
||||
private readonly ForeignKey<FileEntityBuilder> _folderForeignKey = new("FK_File_Folder", x => x.FolderId, "Folder", "FolderId", ReferentialAction.Cascade);
|
||||
|
||||
public FileEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public FileEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<FolderEntityBuilder> _primaryKey = new("PK_Folder", x => x.FolderId);
|
||||
private readonly ForeignKey<FolderEntityBuilder> _siteForeignKey = new("FK_Folder_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public FolderEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public FolderEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "Job";
|
||||
private readonly PrimaryKey<JobEntityBuilder> _primaryKey = new("PK_Job", x => x.JobId);
|
||||
|
||||
public JobEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public JobEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<JobLogEntityBuilder> _primaryKey = new("PK_JobLog", x => x.JobLogId);
|
||||
private readonly ForeignKey<JobLogEntityBuilder> _jobLogForeignKey = new("FK_JobLog_Job", x => x.JobId, "Job", "JobId", ReferentialAction.Cascade);
|
||||
|
||||
public JobLogEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public JobLogEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<LanguageEntityBuilder> _primaryKey = new("PK_Language", x => x.LanguageId);
|
||||
private readonly ForeignKey<LanguageEntityBuilder> _siteForeignKey = new("FK_Language_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public LanguageEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public LanguageEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<LogEntityBuilder> _primaryKey = new("PK_Log", x => x.LogId);
|
||||
private readonly ForeignKey<LogEntityBuilder> _siteForeignKey = new("FK_Log_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public LogEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public LogEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "ModuleDefinition";
|
||||
private readonly PrimaryKey<ModuleDefinitionsEntityBuilder> _primaryKey = new("PK_ModuleDefinition", x => x.ModuleDefinitionId);
|
||||
|
||||
public ModuleDefinitionsEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public ModuleDefinitionsEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<ModuleEntityBuilder> _primaryKey = new("PK_Module", x => x.ModuleId);
|
||||
private readonly ForeignKey<ModuleEntityBuilder> _siteForeignKey = new("FK_Module_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public ModuleEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public ModuleEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<NotificationEntityBuilder> _primaryKey = new("PK_Notification", x => x.NotificationId);
|
||||
private readonly ForeignKey<NotificationEntityBuilder> _siteForeignKey = new("FK_Notification_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public NotificationEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public NotificationEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<PageEntityBuilder> _primaryKey = new("PK_Page", x => x.PageId);
|
||||
private readonly ForeignKey<PageEntityBuilder> _siteForeignKey = new("FK_Page_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public PageEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public PageEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly ForeignKey<PageModuleEntityBuilder> _moduleForeignKey = new("FK_PageModule_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.NoAction);
|
||||
private readonly ForeignKey<PageModuleEntityBuilder> _pageForeignKey = new("FK_PageModule_Page", x => x.PageId, "Page", "PageId", ReferentialAction.Cascade);
|
||||
|
||||
public PageModuleEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public PageModuleEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly ForeignKey<PermissionEntityBuilder> _userForeignKey = new("FK_Permission_User", x => x.UserId, "User", "UserId", ReferentialAction.NoAction);
|
||||
private readonly ForeignKey<PermissionEntityBuilder> _roleForeignKey = new("FK_Permission_Role", x => x.RoleId, "Role", "RoleId", ReferentialAction.NoAction);
|
||||
|
||||
public PermissionEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public PermissionEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<ProfileEntityBuilder> _primaryKey = new("PK_Profile", x => x.ProfileId);
|
||||
private readonly ForeignKey<ProfileEntityBuilder> _siteForeignKey = new("FK_Profile_Sites", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public ProfileEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public ProfileEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<RoleEntityBuilder> _primaryKey = new("PK_Role", x => x.RoleId);
|
||||
private readonly ForeignKey<RoleEntityBuilder> _siteForeignKey = new("FK_Role_Site", x => x.SiteId, "Site", "SiteId", ReferentialAction.Cascade);
|
||||
|
||||
public RoleEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public RoleEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "Setting";
|
||||
private readonly PrimaryKey<SettingEntityBuilder> _primaryKey = new("PK_Setting", x => x.SettingId);
|
||||
|
||||
public SettingEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public SettingEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "Site";
|
||||
private readonly PrimaryKey<SiteEntityBuilder> _primaryKey = new("PK_Site", x => x.SiteId);
|
||||
|
||||
public SiteEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public SiteEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "Tenant";
|
||||
private readonly PrimaryKey<TenantEntityBuilder> _primaryKey = new("PK_Tenant", x => x.TenantId);
|
||||
|
||||
public TenantEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database): base(migrationBuilder, database)
|
||||
public TenantEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database): base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private const string _entityTableName = "User";
|
||||
private readonly PrimaryKey<UserEntityBuilder> _primaryKey = new("PK_User", x => x.UserId);
|
||||
|
||||
public UserEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public UserEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||
private readonly ForeignKey<UserRoleEntityBuilder> _userForeignKey = new("FK_UserRole_User", x => x.UserId, "User", "UserId", ReferentialAction.Cascade);
|
||||
private readonly ForeignKey<UserRoleEntityBuilder> _roleForeignKey = new("FK_UserRole_Role", x => x.RoleId, "Role", "RoleId", ReferentialAction.NoAction);
|
||||
|
||||
public UserRoleEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public UserRoleEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -8,12 +8,12 @@ namespace Oqtane.Migrations
|
|||
{
|
||||
public abstract class MultiDatabaseMigration : Migration
|
||||
{
|
||||
protected MultiDatabaseMigration(IOqtaneDatabase database)
|
||||
protected MultiDatabaseMigration(IDatabase database)
|
||||
{
|
||||
ActiveDatabase = database;
|
||||
}
|
||||
|
||||
protected IOqtaneDatabase ActiveDatabase { get; }
|
||||
protected IDatabase ActiveDatabase { get; }
|
||||
|
||||
protected string RewriteName(string name)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Oqtane.Migrations.Framework
|
|||
{
|
||||
public class MultiDatabaseMigrationsAssembly: MigrationsAssembly
|
||||
{
|
||||
private readonly IOqtaneDatabase _database;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
public MultiDatabaseMigrationsAssembly(
|
||||
ICurrentDbContext currentContext,
|
||||
|
@ -28,7 +28,7 @@ namespace Oqtane.Migrations.Framework
|
|||
}
|
||||
public override Migration CreateMigration(TypeInfo migrationClass, string activeProvider)
|
||||
{
|
||||
var hasCtorWithCacheOptions = migrationClass.GetConstructor(new[] { typeof(IOqtaneDatabase) }) != null;
|
||||
var hasCtorWithCacheOptions = migrationClass.GetConstructor(new[] { typeof(IDatabase) }) != null;
|
||||
|
||||
if (hasCtorWithCacheOptions)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Oqtane.Modules.HtmlText.Migrations
|
|||
[Migration("HtmlText.01.00.00.00")]
|
||||
public class InitializeModule : MultiDatabaseMigration
|
||||
{
|
||||
public InitializeModule(IOqtaneDatabase database) : base(database)
|
||||
public InitializeModule(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Oqtane.Modules.HtmlText.Migrations.EntityBuilders
|
|||
private readonly PrimaryKey<HtmlTextEntityBuilder> _primaryKey = new("PK_HtmlText", x => x.HtmlTextId);
|
||||
private readonly ForeignKey<HtmlTextEntityBuilder> _moduleForeignKey = new("FK_HtmlText_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
||||
|
||||
public HtmlTextEntityBuilder(MigrationBuilder migrationBuilder, IOqtaneDatabase database) : base(migrationBuilder, database)
|
||||
public HtmlTextEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||
{
|
||||
EntityTableName = _entityTableName;
|
||||
PrimaryKey = _primaryKey;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Oqtane.Repository
|
|||
_accessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
public IOqtaneDatabase ActiveDatabase { get; private set; }
|
||||
public IDatabase ActiveDatabase { get; private set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace Oqtane.Repository
|
|||
if (!String.IsNullOrEmpty(_databaseType))
|
||||
{
|
||||
var type = Type.GetType(_databaseType);
|
||||
ActiveDatabase = Activator.CreateInstance(type) as IOqtaneDatabase;
|
||||
ActiveDatabase = Activator.CreateInstance(type) as IDatabase;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_connectionString) && ActiveDatabase != null)
|
||||
|
|
|
@ -4,6 +4,7 @@ using Oqtane.Databases.Interfaces;
|
|||
using Oqtane.Extensions;
|
||||
using Oqtane.Interfaces;
|
||||
using Oqtane.Models;
|
||||
using IDatabase = Oqtane.Databases.Interfaces.IDatabase;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
@ -15,9 +16,9 @@ namespace Oqtane.Repository
|
|||
public class InstallationContext : DbContext
|
||||
{
|
||||
private readonly string _connectionString;
|
||||
private readonly IOqtaneDatabase _database;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
public InstallationContext(IOqtaneDatabase database, string connectionString)
|
||||
public InstallationContext(IDatabase database, string connectionString)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_database = database;
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Oqtane.Repository
|
|||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public IOqtaneDatabase ActiveDatabase { get; private set; }
|
||||
public IDatabase ActiveDatabase { get; private set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ namespace Oqtane.Repository
|
|||
if (!String.IsNullOrEmpty(_databaseType))
|
||||
{
|
||||
var type = Type.GetType(_databaseType);
|
||||
ActiveDatabase = Activator.CreateInstance(type) as IOqtaneDatabase;
|
||||
ActiveDatabase = Activator.CreateInstance(type) as IDatabase;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_connectionString) && ActiveDatabase != null)
|
||||
|
|
|
@ -108,13 +108,13 @@ namespace Oqtane.Repository
|
|||
return script;
|
||||
}
|
||||
|
||||
private IOqtaneDatabase GetActiveDatabase(string databaseType)
|
||||
private IDatabase GetActiveDatabase(string databaseType)
|
||||
{
|
||||
IOqtaneDatabase activeDatabase = null;
|
||||
IDatabase activeDatabase = null;
|
||||
if (!String.IsNullOrEmpty(databaseType))
|
||||
{
|
||||
var type = Type.GetType(databaseType);
|
||||
activeDatabase = Activator.CreateInstance(type) as IOqtaneDatabase;
|
||||
activeDatabase = Activator.CreateInstance(type) as IDatabase;
|
||||
}
|
||||
|
||||
return activeDatabase;
|
||||
|
|
Loading…
Reference in New Issue
Block a user