Share via


FeatureGateAttribute Class

Definition

An attribute that can be placed on MVC controllers, controller actions, or Razor pages to require all or any of a set of feature flags to be enabled.

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
public class FeatureGateAttribute : Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute, Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)>]
type FeatureGateAttribute = class
    inherit ActionFilterAttribute
    interface IAsyncPageFilter
    interface IFilterMetadata
Public Class FeatureGateAttribute
Inherits ActionFilterAttribute
Implements IAsyncPageFilter
Inheritance
FeatureGateAttribute
Attributes
Implements

Constructors

FeatureGateAttribute(Object[])

Creates an attribute that will gate actions or pages unless all the provided feature flag(s) are enabled.

FeatureGateAttribute(RequirementType, Object[])

Creates an attribute that can be used to gate actions or pages. The gate can be configured to require all or any of the provided feature flag(s) to pass.

FeatureGateAttribute(RequirementType, String[])

Creates an attribute that can be used to gate actions or pages. The gate can be configured to require all or any of the provided feature flag(s) to pass.

FeatureGateAttribute(String[])

Creates an attribute that will gate actions or pages unless all the provided feature flag(s) are enabled.

Properties

FeatureFlags

The name of the feature flags that the feature gate attribute will activate for.

Features

The name of the features that the feature attribute will activate for.

RequirementType

Controls whether any or all feature flags in FeatureFlags should be enabled to pass.

Methods

OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate)

Performs controller action pre-procesing to ensure that at least one of the specified feature flags are enabled.

OnPageHandlerExecutionAsync(PageHandlerExecutingContext, PageHandlerExecutionDelegate)

Called asynchronously before the handler method is invoked, after model binding is complete.

OnPageHandlerSelectionAsync(PageHandlerSelectedContext)

Called asynchronously after the handler method has been selected, but before model binding occurs.

Applies to