1
0

BasicAuth bezieht Realm aus dem Validator. DNS Resolve für E-Mail Validierung geändert. Moq-Package hinzugefügt.

This commit is contained in:
2022-01-30 14:25:13 +01:00
parent a885f15ebb
commit 80e5382553
11 changed files with 247 additions and 19 deletions

View File

@@ -66,19 +66,24 @@ namespace Microsoft.EntityFrameworkCore
return DatabaseProvider.SQLite;
if (provider.Contains("sqlclient", StringComparison.OrdinalIgnoreCase))
return DatabaseProvider.SQLServer;
if (provider.Contains("inmemory", StringComparison.OrdinalIgnoreCase))
return DatabaseProvider.InMemory;
throw new DatabaseProviderException($"The database provider '{provider}' is unknown");
}
private static async Task<bool> CreateMigrationsTable(this DbConnection connection, DatabaseMigrationOptions options, CancellationToken cancellationToken)
{
if (connection.GetProviderType() == DatabaseProvider.InMemory)
return true;
try
{
using var command = connection.CreateCommand();
#pragma warning disable CS8524 // missing default case
#pragma warning disable CS8509 // ignore missing cases
command.CommandText = connection.GetProviderType() switch
#pragma warning restore CS8524 // missing default case
#pragma warning restore CS8509 // ignore missing cases
{
DatabaseProvider.MySQL => $@"CREATE TABLE IF NOT EXISTS `{options.MigrationsTableName}` (
`id` INT NOT NULL AUTO_INCREMENT,
@@ -135,6 +140,9 @@ END;"
private static async Task<bool> Migrate(this DbConnection connection, DatabaseMigrationOptions options, CancellationToken cancellationToken)
{
if (connection.GetProviderType() == DatabaseProvider.InMemory)
return true;
try
{
List<string> availableMigrationFiles;
@@ -279,7 +287,8 @@ END;"
Oracle = 2,
PostgreSQL = 3,
SQLite = 4,
SQLServer = 5
SQLServer = 5,
InMemory = 6,
}
}
}

View File

@@ -79,6 +79,10 @@ namespace Microsoft.EntityFrameworkCore
case "mssql":
methodInfo = extensionType.GetMethod("UseSqlServer", new Type[] { typeof(DbContextOptionsBuilder), typeof(string), actionType });
break;
case "memory":
case "inmemory":
methodInfo = extensionType.GetMethod("UseInMemoryDatabase", new Type[] { typeof(DbContextOptionsBuilder), typeof(string), actionType });
break;
default:
throw new DatabaseProviderException($"Unknown database provider: {provider}");
}
@@ -122,6 +126,10 @@ namespace Microsoft.EntityFrameworkCore
case "mssql":
builderType = Type.GetType("Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.SqlServer");
break;
case "memory":
case "inmemory":
builderType = Type.GetType("Microsoft.EntityFrameworkCore.Infrastructure.InMemoryDbContextOptionsBuilder, Microsoft.EntityFrameworkCore.InMemory");
break;
default:
throw new ArgumentException($"Unknown database provider: {provider}");
}
@@ -155,6 +163,10 @@ namespace Microsoft.EntityFrameworkCore
case "mssql":
extensionType = Type.GetType("Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions, Microsoft.EntityFrameworkCore.SqlServer");
break;
case "memory":
case "inmemory":
extensionType = Type.GetType("Microsoft.EntityFrameworkCore.InMemoryDbContextOptionsExtensions, Microsoft.EntityFrameworkCore.InMemory");
break;
default:
throw new ArgumentException($"Unknown database provider: {provider}");
}
@@ -219,6 +231,10 @@ namespace Microsoft.EntityFrameworkCore
}
cs.Add("Connect Timeout=15");
break;
case "memory":
case "inmemory":
cs.Add(configuration.GetValue("Name", provider));
break;
default:
throw new DatabaseProviderException($"Unknown database provider: {provider}");
}