ArgumentativeFilters 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ArgumentativeFilters --version 0.0.3
                    
NuGet\Install-Package ArgumentativeFilters -Version 0.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ArgumentativeFilters" Version="0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ArgumentativeFilters" Version="0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="ArgumentativeFilters" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ArgumentativeFilters --version 0.0.3
                    
#r "nuget: ArgumentativeFilters, 0.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ArgumentativeFilters@0.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ArgumentativeFilters&version=0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=ArgumentativeFilters&version=0.0.3
                    
Install as a Cake Tool

Argumentative Filters

NuGet

⚠️ This package is currently in preview, and is subject to change.

Background

In classic ASP.Net Core APIs, IActionFilter.ActionExecutingContext provides access to IDictionary<string, object?> ActionArguments which is a name-value collection of the parameters that will be provided to the Controller action that will be run.

There isn't a direct equivalent to that in AspNetCore Minimal APIs, instead, an EndpointFilterInvocationContext is passed, which instead has in IList<object?> Arguments for accessing the Minimal API endpoint delegate argument values.

To be able to access arguments by name, a filter factory must be created that takes an EndpointFilterFactoryContext which contains a MethodInfo representing the endpoint delegate, from which you can retrieve the parameter position of the parameters by name, and use that to index into the Arguments collection.

If that sounds a bit labour intensive, that's because it is. That's where Argumentative Filters come in.

With Argumentative Filters, a filter can be created as a static method that takes an EndpointFilterInvocationContext and an EndpointFilterDelegate as required parameters. Other kinds of parameters are also supported, documentation for these can be found here.

Usage

Filter

public static partial class ExampleFilter
{
    [ArgumentativeFilter]
    public static ValueTask<object?> NormalizeParameterCase(EndpointFilterInvocationContext context, EndpointFilterDelegate next, string parameter, [IndexOf(nameof(parameter))] int parameterIndex)
    {
        context.Arguments[parameterIndex] = parameter.ToUpperInvariant();
        return next(context);
    }
}

Minimal API Route Configuration

app.MapGet("/my/route/{parameter}", (string parameter) => parameter)
    .AddEndpointFilterFactory(ExampleFilter.Factory);
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.13 347 9/23/2025
0.0.12 3,687 7/2/2024
0.0.11 384 3/30/2024
0.0.11-preview.1 82 3/29/2024
0.0.10 197 3/18/2024
0.0.9 197 3/7/2024
0.0.9-preview.1 91 3/6/2024
0.0.8 393 1/21/2024
0.0.7 329 1/3/2024
0.0.6 334 11/2/2023
0.0.5 278 9/13/2023
0.0.4 330 8/4/2023
0.0.4-preview.2 151 7/15/2023
0.0.4-preview.1 162 7/7/2023
0.0.3 258 6/15/2023
0.0.2-preview.2 144 5/16/2023
0.0.2-preview.1 149 5/16/2023
0.0.2-preview 239 5/14/2023
0.0.1-preview9 287 4/16/2023
0.0.1-preview8 308 4/12/2023
0.0.1-preview7 261 4/11/2023
0.0.1-preview6 276 4/10/2023