Localization fixes - table definition, SQL script naming, SQL script not marked as Embedded Resource, changed column name from IsCurrrent to IsDefault to reflect intent, set default language for site in _Host

This commit is contained in:
Shaun Walker
2021-01-21 17:09:34 -05:00
parent 82a118b603
commit c0ed7c7934
14 changed files with 178 additions and 94 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
@ -10,20 +10,24 @@ namespace Oqtane.Repository
{
public class DBContextBase : IdentityUserContext<IdentityUser>
{
private Tenant _tenant;
private ITenantResolver _tenantResolver;
private IHttpContextAccessor _accessor;
public DBContextBase(ITenantResolver tenantResolver, IHttpContextAccessor accessor)
{
_tenant = tenantResolver.GetTenant();
_tenantResolver = tenantResolver;
_accessor = accessor;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(_tenant.DBConnectionString
.Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory")?.ToString())
);
var tenant = _tenantResolver.GetTenant();
if (tenant != null)
{
optionsBuilder.UseSqlServer(tenant.DBConnectionString
.Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory")?.ToString())
);
}
base.OnConfiguring(optionsBuilder);
}