You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I want change strategy for MutliTenant with WithHostStrategy. I added .WithHostStrategy("*.tenant.?") keyword like below and load tenant list from config file. but I get authentication error.
What is your suggetions? @fretje@justSteve@pashaie@maxiar@geekz-reno@iammukeshm
regards
ArgumentNullException.ThrowIfNull(services);
_ = services.AddTransient<IConnectionStringValidator, ConnectionStringValidator>();
_ = services.BindDbContext<TenantDbContext>();
_ = services.AddMultiTenant<FshTenantInfo>(config =>
{
// to save database calls to resolve tenant
// this was happening for every request earlier, leading to ineffeciency
config.Events.OnTenantResolveCompleted = async (context) =>
{
if (context.MultiTenantContext.StoreInfo is null) return;
if (context.MultiTenantContext.StoreInfo.StoreType != typeof(DistributedCacheStore<FshTenantInfo>))
{
var sp = ((HttpContext)context.Context!).RequestServices;
var distributedCacheStore = sp
.GetService<IEnumerable<IMultiTenantStore<FshTenantInfo>>>()!
.FirstOrDefault(s => s.GetType() == typeof(DistributedCacheStore<FshTenantInfo>));
_ = await distributedCacheStore!.TryAddAsync(context.MultiTenantContext.TenantInfo!);
}
await Task.FromResult(0);
};
})
.WithHostStrategy("*.__tenant__.?")
// removed other strategies
.WithConfigurationStore() // load from config file
.WithDistributedCacheStore(TimeSpan.FromMinutes(60))
.WithEFCoreStore<TenantDbContext, FshTenantInfo>();
_ = services.AddScoped<ITenantService, TenantService>();
return services;
Hi,
I want change strategy for MutliTenant with WithHostStrategy. I added .WithHostStrategy("*.tenant.?") keyword like below and load tenant list from config file. but I get authentication error.
What is your suggetions?
@fretje @justSteve @pashaie @maxiar @geekz-reno @iammukeshm
regards
part of appseting.config file:
The text was updated successfully, but these errors were encountered: