use DbContextFactory in SiteRepository

This commit is contained in:
sbwalker
2024-03-06 16:56:27 -05:00
parent 020fa4eefa
commit 1c31c1947c
2 changed files with 20 additions and 12 deletions

View File

@ -44,6 +44,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
services.AddDbContext<MasterDBContext>(options => { }, ServiceLifetime.Transient);
services.AddDbContext<TenantDBContext>(options => { }, ServiceLifetime.Transient);
services.AddDbContextFactory<TenantDBContext>(opt => { }, ServiceLifetime.Transient);
return services;
}
@ -316,7 +317,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
if (implementationType.Name == "HtmlTextContext")
{
services.AddDbContextFactory<Oqtane.Modules.HtmlText.Repository.HtmlTextContext>(opt => { }, ServiceLifetime.Scoped);
services.AddDbContextFactory<Oqtane.Modules.HtmlText.Repository.HtmlTextContext>(opt => { }, ServiceLifetime.Transient);
}
// need a way to call AddDbContextFactory dynamically passing the implementationType
//typeof(IServiceCollection)