Change in the documentation
The two examples for registering a custom provider (and adding a domain-scoped provider) do not compile as they are found. The AddOpenFeature() service collection extension method returns a IServiceCollection, not a OpenFeatureBuilder.
see
services.AddOpenFeature()
.AddProvider(provider =>
{
// Resolve services or configurations as needed
var configuration = provider.GetRequiredService<IConfiguration>();
var flags = new Dictionary<string, Flag>
{
{ "feature-key", new Flag<bool>(configuration.GetValue<bool>("FeatureFlags:Key")) }
};
// Register a custom provider, such as InMemoryProvider
return new InMemoryProvider(flags);
});
and
services.AddOpenFeature()
.AddProvider("my-domain", (provider, domain) =>
{
// Resolve services or configurations as needed for the domain
var flags = new Dictionary<string, Flag>
{
{ $"{domain}-feature-key", new Flag<bool>(true) }
};
// Register a domain-scoped custom provider such as InMemoryProvider
return new InMemoryProvider(flags);
});
Should be a relatively quick fix to shift the code into a delegate within the AddOpenFeature(builder => {}) extension method
Change in the documentation
The two examples for registering a custom provider (and adding a domain-scoped provider) do not compile as they are found. The
AddOpenFeature()service collection extension method returns aIServiceCollection, not aOpenFeatureBuilder.see
and
Should be a relatively quick fix to shift the code into a delegate within the
AddOpenFeature(builder => {})extension method