Controllers & Actions

Feature flags in Controllers

Entire controllers, or individual actions can be annotated with the FeatureGate attribute. If the feature is off, they can't execute

[FeatureGate(FeatureFlags.Users)]
[Route("users")]
[Controller]
public class UsersController : Controller
{
    ...
}

Feature usage in Controllers

Stats are collected automatically when a feature is evaluated, but using is different than being available. To mark a controller or controller method to count as active use of a feature (for usage reporting) just add the FeatureUsage attribute

[FeatureGate(FeatureFlags.Users)]
[FeatureUsage(FeatureFlags.Users)]
[Route("users")]
[Controller]
public class UsersController : Controller
{
    ...
}

Last updated

Was this helpful?