Mvc.ModelBinding.MultiParameter 1.1.8

dotnet add package Mvc.ModelBinding.MultiParameter --version 1.1.8
NuGet\Install-Package Mvc.ModelBinding.MultiParameter -Version 1.1.8
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="Mvc.ModelBinding.MultiParameter" Version="1.1.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mvc.ModelBinding.MultiParameter --version 1.1.8
#r "nuget: Mvc.ModelBinding.MultiParameter, 1.1.8"
#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.
// Install Mvc.ModelBinding.MultiParameter as a Cake Addin
#addin nuget:?package=Mvc.ModelBinding.MultiParameter&version=1.1.8

// Install Mvc.ModelBinding.MultiParameter as a Cake Tool
#tool nuget:?package=Mvc.ModelBinding.MultiParameter&version=1.1.8

Mvc.ModelBinding.MultiParameter

Nuget package https://www.nuget.org/packages/Mvc.ModelBinding.MultiParameter/

Calling controller methods using multiple parameter binding.

[HttpPost]
[Route("~/api/SomeMethod/{SomeParameter2}")]
public async Task<IActionResult> SomeMethod(
	[FromCooky(Name = ".AspNetCore.Session")] string SomeParameter0, // #######
	[FromHeader(Name = "Referer")] string SomeParameter1,	// "https://localhost:44346/"
	[FromRoute] string SomeParameter2,			// "two"
	[FromQuery] string SomeParameter3,			// "three"
	[FromBody] ApiModel SomeParameter4,			//  {four}
	[FromBody] string SomeParameter5,			//  "five" (multi binding FromBody)
	[FromQuery]string SomeParameter6)			//  "six" (multi binding FromQuery)
{
	await Task.Yield();
	return Ok();
}

And if parameter names are unique this can be simplified to:

[HttpPost]
[Route("~/api/OtherMethod/{SomeParameter2}")]
public async Task<IActionResult> OtherMethod(
	string Referer,			// "https://localhost:44346/"
	string SomeParameter2,		// "two"
	string SomeParameter3,		// "three"
	ApiModel SomeParameter4,	//  {four}
	string SomeParameter5,		//  "five" (multi binding FromBody)
	string SomeParameter6)		//  "six" (multi binding FromQuery)
{
	await Task.Yield();
	return Ok();
}

This test uses netproxy javascript caller for posting Json to controllers.

r = await netproxyasync("./api/SomeMethod/two?SomeParameter3=three&SomeParameter6=six",
{
  "SomeParameter4": // Now the beast has a name
  {
    Name: "four",
    "Users":
    [
      [{ Name: "User00", Alias: ['aliasa', 'aliasb', 'aliasc'] }, { Name: "User01" }],
      [{ Name: "User10" }, { Name: "User11" }],
      [{ Name: "User20" }, { Name: "User21" }]
    ]
  },
  "SomeParameter5": "five" // double binder
});

For the multi parameter binding use the WithMultiParameterModelBinding. Example Program.cs:

var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
    ContentRootPath = AppDomain.CurrentDomain.BaseDirectory
});

builder.Services.AddMvcCore().WithMultiParameterModelBinding();

var app = builder.Build();
app.UseRouting();
app.MapControllers();
app.UseDefaultFiles();
app.UseStaticFiles();
app.Run();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Mvc.ModelBinding.MultiParameter:

Package Downloads
netproxy

netproxy is a lite framework for posting multiparameter data in json format to .net core controllers (including uploads and progress events)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.8 1,050 11/17/2023
1.1.4 36,807 5/9/2022