FeatureToggle is customisable and extensible in a number of ways.
Just implement IFeatureToggle
and provide an implementation for FeatureEnabled
- easy :)
Then just use this as a base class or as a toggle itself.
When using the built-in Toggle types, they default to getting their values from some configuration.
You can create your own provider and use it with the built-in Toggles.
For the SimpleFeatureToggle
and SqlFeatureToggle
, create a class that implements IBooleanToggleValueProvider
and after you instantiate your Toggle set its BooleanToggleValueProvider
property to an instance of your custom provider.
Alternatively, when you create your Toggle class and derive it from one of the base classes, override the ToggleValueProvider
property to return an instance of your custom provider.
Jason Roberts is a Microsoft MVP, Pluralsight course author and Journeyman Software Developer with over 12 years experience.
He is the author of the books Keeping Software Soft and C# Tips and writes at his blog DontCodeTired.com.