Flipadelphia Component Documentation
Introduction
The Flipadelphia
component provides a flexible and robust mechanism for feature toggling within Blazor applications. It allows developers to dynamically display different content based on the state of a feature flag.
Installation
- Install the
Flipadelphia
Razor Class Library from the NuGet package manager or by adding a reference to your Blazor project. - Ensure you have the
Microsoft.Extensions.Configuration
namespace referenced in your project, asFlipadelphia
requires it for feature flag checks.
Usage
To use the Flipadelphia
component, follow these steps:
-
Add the component to your Blazor page or component:
<Flipadelphia FeatureName="MyFeature" Configuration="@Configuration"> <FeatureIsOnTemplate> <!-- Content to display when the feature is ON --> </FeatureIsOnTemplate> <FeatureIsOffTemplate> <!-- Content to display when the feature is OFF --> </FeatureIsOffTemplate> </Flipadelphia>
-
Parameters:
FeatureName
(Required): The name of the feature as defined in your application's configuration.Configuration
(Required): An instance ofIConfiguration
that the component uses to check the feature's state.
-
Templates:
FeatureIsOnTemplate
: Defines the content to display when the feature is turned on.FeatureIsOffTemplate
: Defines the content to display when the feature is turned off.
Configuration
In your application's configuration (e.g., appsettings.json
), define the state of your features:
{
"Features": {
"MyFeature": true,
"AnotherFeature": false
}
}
Set the feature to true
to turn it on, and false
to turn it off.
Best Practices
- Environment-Specific Configurations: Maintain separate configuration files for different environments (Development, Staging, Production) to control feature flags independently.
- Code Reviews: Regularly review any changes related to feature flags to ensure the desired behavior.
- Monitoring and Alerting: Set up monitoring for feature flag changes, especially in production, to detect and react to any unexpected behavior.
Limitations
- Features that should never be enabled in certain environments (e.g., production) should have additional checks in the code to prevent accidental activation.
Support
For any issues, questions, or feature requests related to the Flipadelphia
component, please Add a GitHub Issues.