Closed geeknoid closed 5 months ago
@halter73 Can we please schedule this for review ASAP, we've got stuff blocked behind this.
Thanks.
Some thought should be put into how this might interact with underlying configuration stores that extend the configuration system. For example Azure AppConfig has the concept of tags which can be used to produce a different set of configuration values.
This could work nicely with that.
API Review Notes:
IOptionsContextReceiver
implementations are there in practice?
IContextualOptions<TOptions, TContext>
could be made public, and types like ILoadContextualOptions<TOptions>
could be kept internal for now.The lack of a non-internal implementation is a sticking point. We don't want to approve an abstraction that has a single implementation because it's unclear if it will work for any other implementations.
closed this as completed
@geeknoid could you please help me understand the "completed" part? Judging by the API review comments there was feedback to work through before the API could be implemented. If we are deciding to not currently pursue this API then "not planned" should be more appropriate resolution. What am I missing?
Background and motivation
This proposal (and matching implementation) aims to extend the existing .NET options model to fully support experimentation. The feature makes it possible to query the option system while supply some contextual information which tailors the returned configuration state. For example, an app can query to get the options for a particular region, or a particular cluster, or whatever the app wants.
You can find the code for this design in https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.Options.Contextual.
API Proposal
The provider API is for a component that couples the contextual option machinery with an actual infrastructure that delivers contextual option state.
API Usage
Start with an option type.
Define a context and a receiver that will be used as inputs to dynamically configure the options.
Create a service that consumes the options for a given context.
The options can be configured with both global options (ForecastDays), and options that vary depending on the current context (TemperatureScale).
And lastly, the service is called with some context.
Alternative Designs
No response
Risks
No response