Adding new DatabaseConfig components in the Client project for supported Databases to avoid deploying server dlls to client

This commit is contained in:
Charles Nurse
2021-04-27 15:35:10 -07:00
parent 8f5beaf3fe
commit 1efd623a99
19 changed files with 664 additions and 303 deletions

View File

@ -15,16 +15,7 @@ namespace Oqtane.Database.MySQL
private static string _name => "MySQL";
private static readonly List<ConnectionStringField> _connectionStringFields = new()
{
new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"},
new() {Name = "Port", FriendlyName = "Port", Value = "3306", HelpText="Enter the port used to connect to the server"},
new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"},
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 MySQLDatabase() :base(_name, _friendlyName, _connectionStringFields) { }
public MySQLDatabase() :base(_name, _friendlyName) { }
public override string Provider => "MySql.EntityFrameworkCore";
@ -33,28 +24,6 @@ namespace Oqtane.Database.MySQL
return table.Column<int>(name: name, nullable: false).Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn);
}
public override string BuildConnectionString()
{
var connectionString = String.Empty;
var server = ConnectionStringFields[0].Value;
var port = ConnectionStringFields[1].Value;
var database = ConnectionStringFields[2].Value;
var userId = ConnectionStringFields[3].Value;
var password = ConnectionStringFields[4].Value;
if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(password))
{
connectionString = $"Server={server};Database={database};Uid={userId};Pwd={password};";
}
if (!String.IsNullOrEmpty(port))
{
connectionString += $"Port={port};";
}
return connectionString;
}
public override string ConcatenateSql(params string[] values)
{
var returnValue = "CONCAT(";