microsoft / microsoft/FeatureManagement-Dotnet
How to programmatically create an “always enabled” FeatureDefinition?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 129
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 5
Description
I’m implementing a custom IFeatureDefinitionProvider that reads features from a database or an HTTP service instead of JSON configuration. My goal is to represent a feature that is always enabled, equivalent to this JSON:
"FeatureA": {
"enabled": true
}
Looking at the source (ConfigurationFeatureDefinitionProvider.ParseMicrosoftSchemaFeatureDefinition), the library seems to convert such JSON into a FeatureDefinition with:
Status = FeatureStatus.ConditionalEnabledForcontaining a singleFeatureFilterConfigurationwithName = "AlwaysOn"
Example based on my understanding:
var featureEnabled = new FeatureDefinition
{
Name = "FeatureA",
EnabledFor = new List<FeatureFilterConfiguration>
{
new FeatureFilterConfiguration { Name = "AlwaysOn" }
},
Status = FeatureStatus.Conditional
};
My questions:
- Is this the correct/recommended way to create a feature that is always enabled without defining any conditions?
- Is there an official API or helper for this, so I don’t have to replicate the logic from
ConfigurationFeatureDefinitionProvider? - Are there any docs explaining this behavior?
I want to make sure my IFeatureDefinitionProvider correctly handles “always enabled” features without relying on JSON files.
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ConfigurationFeatureDefinitionProvider.ParseMicrosoftSchemaFeatureDefinition and the FeatureDefinition and IFeatureDefinitionProvider APIs. Trace how the JSON example is represented, then check whether a public helper or documentation covers constructing the equivalent definition. Done means a maintainer-verified answer describing the supported construction and its semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100