Show / Hide Table of Contents

Class FeatureToggle

Use this class to ask for the current value of a Feature Toggle, by calling the IsOn<TConcreteToggle>() method

Inheritance
Object
FeatureToggle
Namespace: SuperOffice.FeatureToggles
Assembly: SoCore.dll
Syntax
public static class FeatureToggle : Object

Methods

IsOn<TConcreteToggle>()

Determine if a feature toggle is on or off, right now, right here

Declaration
public static bool IsOn<TConcreteToggle>()
    where TConcreteToggle : IFeatureToggle, new()
Returns
Type Description
Boolean

true if on, false if off or unknown

Type Parameters
Name Description
TConcreteToggle

Actual toggle class from the SuperOffice.FeatureToggles assembly

Remarks

Typical code:

if (FeatureToggle.IsOn>NewPricelist<())
{
	// exciting new code
}
else
{
	// whatever we did before, which is the safe option
}

The type passed in as a parameter to IsOn must be an implementation of SuperOffice.FeatureToggles.IFeatureToggle, and God help you if it has not been defined in the global feature toggle assembly in the "Common" kind-of-branch, submitted for build, and updated through NuGet.
That, and that only, is the correct way of defining Feature Toggles.
The actual value is here determined via the ConfigFile, which opens the possibility for overrides via Online/OC. For plain vanilla setting in your web.config or app.config, do as follows: Add the following to your config file in the declaration section:



Then, in the part of the file where values live (for example, after the Factory section):





© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top