Added support for MySQL and ProgreSQL and AddSite/Tenant
This commit is contained in:
		| @ -12,8 +12,8 @@ namespace Oqtane.Databases | ||||
|  | ||||
|         private static readonly List<ConnectionStringField> _connectionStringFields = new() | ||||
|         { | ||||
|             new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB"}, | ||||
|             new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}"} | ||||
|             new() {Name = "Server", FriendlyName = "Server", Value = "(LocalDb)\\MSSQLLocalDB", HelpText="Enter the database server"}, | ||||
|             new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"} | ||||
|         }; | ||||
|  | ||||
|         public LocalDbDatabase() :base(_name, _friendlyName, _connectionStringFields) { } | ||||
|  | ||||
| @ -10,15 +10,16 @@ namespace Oqtane.Databases | ||||
|     public class SqlServerDatabase : SqlServerDatabaseBase | ||||
|     { | ||||
|         private static string _friendlyName => "SQL Server"; | ||||
|  | ||||
|         private static string _name => "SqlServer"; | ||||
|  | ||||
|         private static readonly List<ConnectionStringField> _connectionStringFields = new() | ||||
|         { | ||||
|             new() {Name = "Server", FriendlyName = "Server", Value = "."}, | ||||
|             new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}"}, | ||||
|             new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true"}, | ||||
|             new() {Name = "Uid", FriendlyName = "User Id", Value = ""}, | ||||
|             new() {Name = "Pwd", FriendlyName = "Password", Value = ""} | ||||
|             new() {Name = "Server", FriendlyName = "Server", Value = ".", HelpText="Enter the database server"}, | ||||
|             new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}, | ||||
|             new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"}, | ||||
|             new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"}, | ||||
|             new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"} | ||||
|         }; | ||||
|  | ||||
|         public SqlServerDatabase() :base(_name, _friendlyName, _connectionStringFields) { } | ||||
|  | ||||
| @ -2,36 +2,27 @@ using System.Collections.Generic; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Migrations.Operations; | ||||
| using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders; | ||||
| using Oqtane.Databases; | ||||
| using Oqtane.Interfaces; | ||||
| using Oqtane.Models; | ||||
| using Oqtane.Shared; | ||||
|  | ||||
| namespace Oqtane.Repository.Databases | ||||
| { | ||||
|     public abstract class SqlServerDatabaseBase : IOqtaneDatabase | ||||
|     public abstract class SqlServerDatabaseBase : OqtaneDatabaseBase | ||||
|     { | ||||
|         protected SqlServerDatabaseBase(string name, string friendlyName, List<ConnectionStringField> connectionStringFields) | ||||
|         protected SqlServerDatabaseBase(string name, string friendlyName, List<ConnectionStringField> connectionStringFields) : base(name, friendlyName, connectionStringFields) | ||||
|         { | ||||
|             Name = name; | ||||
|             FriendlyName = friendlyName; | ||||
|             ConnectionStringFields = connectionStringFields; | ||||
|         } | ||||
|  | ||||
|         public  string FriendlyName { get; } | ||||
|         public override string Provider => "Microsoft.EntityFrameworkCore.SqlServer"; | ||||
|  | ||||
|         public string Name { get; } | ||||
|  | ||||
|         public string Provider => "Microsoft.EntityFrameworkCore.SqlServer"; | ||||
|  | ||||
|         public List<ConnectionStringField> ConnectionStringFields { get; } | ||||
|  | ||||
|         public OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name) | ||||
|         public override OperationBuilder<AddColumnOperation> AddAutoIncrementColumn(ColumnsBuilder table, string name) | ||||
|         { | ||||
|             return table.Column<int>(name: name, nullable: false).Annotation("SqlServer:Identity", "1, 1"); | ||||
|         } | ||||
|  | ||||
|         public abstract string BuildConnectionString(); | ||||
|  | ||||
|         public DbContextOptionsBuilder UseDatabase(DbContextOptionsBuilder optionsBuilder, string connectionString) | ||||
|         public override DbContextOptionsBuilder UseDatabase(DbContextOptionsBuilder optionsBuilder, string connectionString) | ||||
|         { | ||||
|             return optionsBuilder.UseSqlServer(connectionString); | ||||
|         } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Charles Nurse
					Charles Nurse