Merge branch 'database' into clean-startup

# Conflicts:
#	Oqtane.Server/Startup.cs
This commit is contained in:
hishamco
2021-04-20 17:42:39 +03:00
120 changed files with 4049 additions and 663 deletions

View File

@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Oqtane.Infrastructure;
using Oqtane.Interfaces;
using Oqtane.Modules;
using Oqtane.Repository;
using Oqtane.Security;
@ -34,14 +35,10 @@ namespace Microsoft.Extensions.DependencyInjection
public static IServiceCollection AddOqtaneDbContext(this IServiceCollection services)
{
services.AddScoped<IDbConfig, DbConfig>();
services.AddDbContext<MasterDBContext>(options => { });
services.AddDbContext<TenantDBContext>(options => { });
services.AddIdentityCore<IdentityUser>(options => { })
.AddEntityFrameworkStores<TenantDBContext>()
.AddSignInManager()
.AddDefaultTokenProviders();
return services;
}
@ -238,6 +235,17 @@ namespace Microsoft.Extensions.DependencyInjection
}
}
// dynamically register database providers
var databaseTypes = assembly.GetInterfaces<IOqtaneDatabase>();
foreach (var databaseType in databaseTypes)
{
if (databaseType.AssemblyQualifiedName != null)
{
var serviceType = Type.GetType("Oqtane.Interfaces.IOqtaneDatabase, Oqtane.Shared");
services.AddScoped(serviceType ?? databaseType, databaseType);
}
}
// dynamically register hosted services
var serviceTypes = assembly.GetTypes(hostedServiceType);
foreach (var serviceType in serviceTypes)