Enhancement - Parameter Caching
Applications using built-in ConfigurationFeatureDefinitionProvider
will now benefit from caching of feature filter parameters. This will improve performance of the application by reducing the number of times a filter's parameters are cast in short time frames, yielding observed performance increase of up to 100x. This change will not affect custom filters by default. For custom filters, the class must implement the IFilterParametersBinder
interface. Below is an example.
class MyFilter : IFeatureFilter, IFilterParametersBinder
{
public object BindParameters(IConfiguration filterParameters)
{
return filterParameters.Get<FilterSettings>();
}
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context, CancellationToken cancellationToken)
{
FilterSettings settings = (FilterSettings)context.Settings;
...
}
}
For more details read here