MinimalHelpers.Binding
1.0.6
dotnet add package MinimalHelpers.Binding --version 1.0.6
NuGet\Install-Package MinimalHelpers.Binding -Version 1.0.6
<PackageReference Include="MinimalHelpers.Binding" Version="1.0.6" />
paket add MinimalHelpers.Binding --version 1.0.6
#r "nuget: MinimalHelpers.Binding, 1.0.6"
// Install MinimalHelpers.Binding as a Cake Addin #addin nuget:?package=MinimalHelpers.Binding&version=1.0.6 // Install MinimalHelpers.Binding as a Cake Tool #tool nuget:?package=MinimalHelpers.Binding&version=1.0.6
Minimal APIs Binding Helpers
A library that provides Binding helpers for Minimal APIs project.
Installation
The library is available on NuGet. Just search MinimalHelpers.Binding in the Package Manager GUI or run the following command in the Package Manager Console:
Install-Package MinimalHelpers.Binding
Usage
IFormFile and IFormFileCollection binding
Use a FormFileContent
or FormFileContentCollection
argument in the route handler that must receive a single file or a collection of files, than call the Accepts
method on the endpoint definition:
app.MapPost("/api/single-file", (FormFileContent file) =>
{
return Results.Ok(new
{
file.Content.FileName,
file.Content.ContentType,
file.Content.Length
});
})
.Accepts<FormFileContent>("multipart/form-data");
app.MapPost("/api/multiple-files", (FormFileContentCollection files) =>
{
return Results.Ok(files.Content.Select(file => new
{
file.FileName,
file.ContentType,
file.Length
}));
})
.Accepts<FormFileContentCollection>("multipart/form-data");
Add the FormFile
Operation Filter to Swagger, so that it will be able to correctly handle file input:
builder.Services.AddSwaggerGen(options =>
{
options.OperationFilter<FormFileOperationFilter>();
});
Contribute
The project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests on the repo and we'll address them as we can.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.2.3)
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 |
---|