AzureFunctions.MvcModelBinding 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package AzureFunctions.MvcModelBinding --version 1.0.3                
NuGet\Install-Package AzureFunctions.MvcModelBinding -Version 1.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="AzureFunctions.MvcModelBinding" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AzureFunctions.MvcModelBinding --version 1.0.3                
#r "nuget: AzureFunctions.MvcModelBinding, 1.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.
// Install AzureFunctions.MvcModelBinding as a Cake Addin
#addin nuget:?package=AzureFunctions.MvcModelBinding&version=1.0.3

// Install AzureFunctions.MvcModelBinding as a Cake Tool
#tool nuget:?package=AzureFunctions.MvcModelBinding&version=1.0.3                

azure-functions-model-binding

Provides ASP.NET Core MVC model binding for Azure Functions v3

Problem

Azure Function v3 is lacking of built-in ASP.NET Core MVC Model Binding attributes like [FromQuery], [FromBody], [FromForm].

Solution

  1. Expose custom Model binding attributes derived from ASP.NET Core MVC attributes
  2. Provide custom extension that derives from "IExtensionConfigProvider"
  3. Finish configuration of ASP.NET Core MVC services
  4. Pass data from Azure Function binding attributes to ASP.NET Core MVC model binderand validator

Example

  1. Add MVC Core services by calling builder.Services.AddMvcCore()
  2. Register Azure Function Model binding by calling .AddFunctionModelBinding()
  3. Add [FromQuery]/[FromBody]/[FromForm] attributes to your function parameters
[FunctionName(QueryData)
public object QueryData(
    [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "data")] HttpRequest request,
    [FromQuery, Required] string filter,
    [FromBody] object content)
{
    // your code goes here
}
  1. Enjoy 😄
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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
6.0.0 3,338 6/4/2024
4.2.1 3,434 9/2/2023
4.2.0 154 9/1/2023
4.1.0 600 5/25/2023
4.0.8.3 157 5/25/2023
4.0.8.2 152 5/25/2023
4.0.8.1 153 5/25/2023
4.0.8 1,124 10/4/2022
4.0.7 390 10/4/2022
4.0.6 375 10/4/2022
4.0.5 565 8/10/2022
4.0.4 479 6/24/2022
4.0.3 3,766 5/10/2022
4.0.2 463 4/23/2022
4.0.1 439 4/22/2022
4.0.0 544 4/22/2022
1.0.6 637 4/6/2022
1.0.5 560 10/25/2021
1.0.4 364 10/25/2021
1.0.3 340 9/28/2021
1.0.2 334 8/26/2021
1.0.1 322 8/26/2021
1.0.0 320 8/25/2021

Throws ValidationException instead System.Exception when validation error occurred