@ismcagdas, do you figure out the reason? could you share some suggestion to us? My application using MPS mode, take too long time get response from server really reduces the user experience.
Thanks your suggestion, I will take a try and let you know the result. But, a little confuses, Can current Tenant per Db setting generate multi database automatically? Otherwise, need to spend time to extend it.
In my scenario multi DbContext means multi database, then one tenant will store data in multi database.
Furthermore, If I can configure the tenant as separated database?
For example, one tenant with 2 DbContext, and it mapping 2 separated database, Db_A and Db_B. Then I configure the tenant as separated database in Host configuration, does that will generate Db_A_Tenant1, Db_B_Tenant1 for Teanant1 and Db_A_Tenant2, Db_B_Tenant2 for Tenant2?
Can I use multi DbContext (in fact, it is multi database instance) and multi tenancy per database in the same time? Is that will create multi database instance for each tenant?
Any updates for this thread? The same application service, if request it via action in a controller, it really spent a long time to get server response. But if request the service via dynamic proxy API, it could get server response quickly.
So, should be some performance issue with it.
For example, the official demo, to get the user list, MPA page will spend more time to get server response than SPA page.
Yes, I put it in the PreInitialize method of Web Module in MVC project, but not remove "/" at the end of the WebSiteRootAddress, when debug it on dev machine sometimes it throw HttpContext is null.
But, I deployed this changes to production, it works as expected, really a little strange. I also extended some customized code to match a customized Host per tenant, code like below:
//Find independency hosts
var tenants = from t in _tenantRepository.GetAllList()
select t;
string[] hosts = null;
foreach (var item in tenants)
{
if (!item.Hosts.IsNullOrEmpty())
{
if (!item.Hosts.Contains(","))
{
hosts = new string[1];
hosts[0] = item.Hosts;
}
else
{
hosts = item.Hosts.Split(',').Length > 0 ? item.Hosts.Split(',') : null;
}
if (hosts.Count() > 0)
{
foreach (var host in hosts)
{
if (host.ToLower() == domainFormat.ToLower())
{
Logger.Info("TenancyName:" + item.TenancyName);
return item.Id;
}
else
{
continue;
}
}
}
}
}
Is the DomainTenantResolverContributor check each request? If that, I need to cache the tenant results from repository.
I have created a similar class like DomainTenantResolverContributor and add the resolver in the Web Module in the MVC project, but when debug it the HttpContext is null
var httpContext = _httpContextAccessor.HttpContext;
if (httpContext == null)
{
return null;
}
Did you get the similar exception before?
No HTTPS enable.
I will send you the demo URL via email.
the configuration in my appsettings.json file like below:
"App": { "WebSiteRootAddress": "http://{TENANCY_NAME}.mydomain.com/" },
After applied this <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1907">https://github.com/aspnetboilerplate/as ... ssues/1907</a> fix, it still cannot resolve my issue that I mentioned before, it is strange sometimes it could find the tenant, sometimes it cannot find the tenant, sometimes it will use host user information instead of the expected Tenant.
Could you have a look again?