Add ability to reset the Lazy tenantId on the MultiTenantDbContext.
Just in case in scenarios like testing or xamarin apps, where you want to re-use the same dbcontext instance, but a user logs in or logs out. In that case you could tell the dbcontext to invalidate its lazily cached tenant id - so it will request it again - and you can return the newly logged in user id.
You would call a method like this on the MultiTenantDbContext
protected void OnTenantChanged()
{
// reset the lazy tenant id.
_tenantId = new Lazy<TIdType>(() =>
{
var t = _tenant();
return GetTenantId(t);
});
}
Add ability to reset the Lazy tenantId on the MultiTenantDbContext. Just in case in scenarios like testing or xamarin apps, where you want to re-use the same dbcontext instance, but a user logs in or logs out. In that case you could tell the dbcontext to invalidate its lazily cached tenant id - so it will request it again - and you can return the newly logged in user id.
You would call a method like this on the
MultiTenantDbContext