Multitenancy and IAppSettings pattern

Any provider that isn’t retrieved at runtime with the IRequest isn’t “multi-tenant aware”. i.e. You’re not going to be able to configure a multi-tenant IAppSettings injected in your classes as it’s a static dependency registered in your AppHost which can’t be configured to use the tenant that’s only known at runtime.

You would need to use a configuration that is multi-tenant aware like the GetRuntimeConfig API added earlier which allows different JWT Configuration at runtime.

The easiest approach for any multi-tenant dependency is to register a factory which accepts an IRequest and returns a multi-tenant configured instance, which for configuration I’d just return a POCO configuration class:

public class MultitentAppConfig
{
    public AppConfig GetTenantConfig(IRequest req) => ...
}

public class MyServices : Service
{
    public MultitentAppConfig AppConfig { get; set; }

    public object Any(MyRequest) 
    {
        var tenantConifg = AppConfig.GetTenantConfig(Request);
    }
}

You could use the same approach if you wanted to re-use the IAppSettings API:

public class MultitenantAppSettings
{
    public IAppSettings GetTenantAppSettings(IRequest request) => ...
}