Share via


FilterCollectionExtensions.AddForFeature<TFilterType> Method

Definition

Adds an MVC filter that will only activate during a request if the specified feature is enabled.

public static Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata AddForFeature<TFilterType> (this Microsoft.AspNetCore.Mvc.Filters.FilterCollection filters, string feature) where TFilterType : Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter;
static member AddForFeature : Microsoft.AspNetCore.Mvc.Filters.FilterCollection * string -> Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata (requires 'FilterType :> Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter)
<Extension()>
Public Function AddForFeature(Of TFilterType As IAsyncActionFilter) (filters As FilterCollection, feature As String) As IFilterMetadata

Type Parameters

TFilterType

The MVC filter to add and use if the feature is enabled.

Parameters

filters
FilterCollection

The filter collection to add to.

feature
String

The feature that will need to enabled to trigger the execution of the MVC filter.

Returns

Applies to