ArgumentativeFilters 0.0.13

dotnet add package ArgumentativeFilters --version 0.0.13
                    
NuGet\Install-Package ArgumentativeFilters -Version 0.0.13
                    
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.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ArgumentativeFilters" Version="0.0.13" />
                    
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.13
                    
#r "nuget: ArgumentativeFilters, 0.0.13"
                    
#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.13
                    
#: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.13
                    
Install as a Cake Addin
#tool nuget:?package=ArgumentativeFilters&version=0.0.13
                    
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);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in 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 341 9/23/2025
0.0.12 3,685 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