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
{{ message }}
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
@HaoK
We have just implemented our custom provider using lazy loading by adding logic to the TryGet().
Our source/provider plugs to DI and resolves our current request context to figure out which client this setting is for.
It will then load all client-specific settings if missing and store them in sub sections of Data dictionary (e.g. clientA:MyOptions:Value, vs :MyOptions:Value).
The biggest roadblock now is to reload only a given client setting and not the entire source...
Was wondering if there might be a way to create a multi-tenant source that adds inner sources dynamically (or in the worst case scenario add them all automtically at startup). Then we might be able to only invalidate one of the inner sources.
Just a thought at this point. Might not be possible or not a very elegant solution...
Some initial thoughts for how this might look, will try switching a few providers over to this to see how it feels.
publicclassLazyConfigurationProvider:IConfigurationProvider{privateConfigurationReloadToken_reloadToken=newConfigurationReloadToken();privateIEnumerable<string>_allKeys;protectedIDictionary<string,string>Data{get;set;}publicabstractIEnumerable<string>LoadAllKeys();publicabstractLoadValue(stringkey);// Interface methodsIEnumerable<string>GetChildKeys(IEnumerable<string>earlierKeys,stringparentPath){// Reuse same code as ConfigurationProvider with _allKeys;}boolTryGet(stringkey,outstringvalue){// If we don't have data already, call LoadValue and store in Data}voidSet(stringkey,stringvalue)=>Data[key]=value;IChangeTokenGetReloadToken()=>_reloadToken;voidLoad(){_allKeys=LoadAllKeys();// We could setup the dictionary with a bunch of Lazy<string> calls to LoadValue to simplify TryGet}}
Are you able to have a provider per tenant? That would align with how reload works
The problem is I would prefer to avoid initializing all client sources/providers at startup.
First it may have a performance impact to set up a config with 1000+ sources that may/may not place any request.
But also how would I handle cases where a client is being provisioned without having to restart the service.
I would rather have the ability to dynamically add the source at runtime the first time a client request comes in.
This is how I'm handling it right now but within a single source. I pull the client settings upon request if not there already.
However when I need to invalidate a single client this model doesn't work.
I'll have to think about this a bit more, we'll discuss this in the next triage as we are seeing a lot of requests about multi-tenancy scenarios. @glennc
We've decided not to purse changes in this direction after discussing our plans for 2.0. This is a fairly advanced scenario that individual providers can attempt if so desired.
Activity
[-]Add support for a lazy ConfigurationProvder[/-][+]Add support for a lazy ConfigurationProvider[/+]passuied commentedon Feb 24, 2017
@HaoK
We have just implemented our custom provider using lazy loading by adding logic to the TryGet().
Our source/provider plugs to DI and resolves our current request context to figure out which client this setting is for.
It will then load all client-specific settings if missing and store them in sub sections of Data dictionary (e.g. clientA:MyOptions:Value, vs :MyOptions:Value).
The biggest roadblock now is to reload only a given client setting and not the entire source...
Was wondering if there might be a way to create a multi-tenant source that adds inner sources dynamically (or in the worst case scenario add them all automtically at startup). Then we might be able to only invalidate one of the inner sources.
Just a thought at this point. Might not be possible or not a very elegant solution...
HaoK commentedon Feb 24, 2017
Are you able to have a provider per tenant? That would align with how reload works
HaoK commentedon Feb 24, 2017
Some initial thoughts for how this might look, will try switching a few providers over to this to see how it feels.
passuied commentedon Feb 24, 2017
@HaoK
The problem is I would prefer to avoid initializing all client sources/providers at startup.
First it may have a performance impact to set up a config with 1000+ sources that may/may not place any request.
But also how would I handle cases where a client is being provisioned without having to restart the service.
I would rather have the ability to dynamically add the source at runtime the first time a client request comes in.
This is how I'm handling it right now but within a single source. I pull the client settings upon request if not there already.
However when I need to invalidate a single client this model doesn't work.
Thoughts?
HaoK commentedon Feb 24, 2017
I'll have to think about this a bit more, we'll discuss this in the next triage as we are seeing a lot of requests about multi-tenancy scenarios. @glennc
HaoK commentedon Mar 27, 2017
We've decided not to purse changes in this direction after discussing our plans for 2.0. This is a fairly advanced scenario that individual providers can attempt if so desired.