MemoryPackHelper.MinimalApi 1.0.1

dotnet add package MemoryPackHelper.MinimalApi --version 1.0.1
                    
NuGet\Install-Package MemoryPackHelper.MinimalApi -Version 1.0.1
                    
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="MemoryPackHelper.MinimalApi" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MemoryPackHelper.MinimalApi" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MemoryPackHelper.MinimalApi" />
                    
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 MemoryPackHelper.MinimalApi --version 1.0.1
                    
#r "nuget: MemoryPackHelper.MinimalApi, 1.0.1"
                    
#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 MemoryPackHelper.MinimalApi@1.0.1
                    
#: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=MemoryPackHelper.MinimalApi&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MemoryPackHelper.MinimalApi&version=1.0.1
                    
Install as a Cake Tool
MemoryPackHelper.MinimalApi

MemoryPackHelper.MinimalApi Assembly

Namespaces

<a name='MemoryPackHelper.MinimalApi'></a>

MemoryPackHelper.MinimalApi Namespace

Classes

<a name='MemoryPackHelper.MinimalApi.Extensions'></a>

Extensions Class

Extensions for RouteHandlerBuilder

public static class Extensions

Inheritance System.Object 🡒 Extensions

Methods

<a name='MemoryPackHelper.MinimalApi.Extensions.AcceptsPacked_TRequest_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,string,string[])'></a>

Extensions.AcceptsPacked<TRequest>(this RouteHandlerBuilder, string, string[]) Method

Adds Microsoft.AspNetCore.Http.Metadata.IAcceptsMetadata to Microsoft.AspNetCore.Builder.EndpointBuilder.Metadata for all endpoints
produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder AcceptsPacked<TRequest>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, string contentType, params string[] additionalContentTypes)
    where TRequest : notnull;
Type parameters

<a name='MemoryPackHelper.MinimalApi.Extensions.AcceptsPacked_TRequest_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,string,string[]).TRequest'></a>

TRequest

The type of the request body.

Parameters

<a name='MemoryPackHelper.MinimalApi.Extensions.AcceptsPacked_TRequest_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,string,string[]).builder'></a>

builder Microsoft.AspNetCore.Builder.RouteHandlerBuilder

The Microsoft.AspNetCore.Builder.RouteHandlerBuilder.

<a name='MemoryPackHelper.MinimalApi.Extensions.AcceptsPacked_TRequest_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,string,string[]).contentType'></a>

contentType System.String

The request content type that the endpoint accepts.

<a name='MemoryPackHelper.MinimalApi.Extensions.AcceptsPacked_TRequest_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,string,string[]).additionalContentTypes'></a>

additionalContentTypes System.String[]

The list of additional request content types that the endpoint accepts.

Returns

Microsoft.AspNetCore.Builder.RouteHandlerBuilder
A Microsoft.AspNetCore.Builder.RouteHandlerBuilder that can be used to further customize the endpoint.

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[])'></a>

Extensions.ProducesPacked<TResponse>(this RouteHandlerBuilder, int, string, string[]) Method

Adds an Microsoft.AspNetCore.Http.Metadata.IProducesResponseTypeMetadata to Microsoft.AspNetCore.Builder.EndpointBuilder.Metadata for all endpoints
produced by builder.

public static Microsoft.AspNetCore.Builder.RouteHandlerBuilder ProducesPacked<TResponse>(this Microsoft.AspNetCore.Builder.RouteHandlerBuilder builder, int statusCode=200, string? contentType=null, params string[] additionalContentTypes);
Type parameters

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[]).TResponse'></a>

TResponse

The type of the response.

Parameters

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[]).builder'></a>

builder Microsoft.AspNetCore.Builder.RouteHandlerBuilder

The Microsoft.AspNetCore.Builder.RouteHandlerBuilder.

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[]).statusCode'></a>

statusCode System.Int32

The response status code. Defaults to Microsoft.AspNetCore.Http.StatusCodes.Status200OK.

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[]).contentType'></a>

contentType System.String

The response content type. Defaults to "application/json".

<a name='MemoryPackHelper.MinimalApi.Extensions.ProducesPacked_TResponse_(thisMicrosoft.AspNetCore.Builder.RouteHandlerBuilder,int,string,string[]).additionalContentTypes'></a>

additionalContentTypes System.String[]

Additional response content types the endpoint produces for the supplied status code.

Returns

Microsoft.AspNetCore.Builder.RouteHandlerBuilder
A Microsoft.AspNetCore.Builder.RouteHandlerBuilder that can be used to further customize the endpoint.

<a name='MemoryPackHelper.MinimalApi.PackableResults'></a>

PackableResults Class

Alternative to Microsoft.AspNetCore.Http.Results for Memorypackable Results

public static class PackableResults

Inheritance System.Object 🡒 PackableResults

Methods

<a name='MemoryPackHelper.MinimalApi.PackableResults.Packed_T_(Microsoft.AspNetCore.Http.HttpContext,T)'></a>

PackableResults.Packed<T>(HttpContext, T) Method

Packeds the specified context.

public static Microsoft.AspNetCore.Http.IResult Packed<T>(Microsoft.AspNetCore.Http.HttpContext context, T res);
Type parameters

<a name='MemoryPackHelper.MinimalApi.PackableResults.Packed_T_(Microsoft.AspNetCore.Http.HttpContext,T).T'></a>

T

Parameters

<a name='MemoryPackHelper.MinimalApi.PackableResults.Packed_T_(Microsoft.AspNetCore.Http.HttpContext,T).context'></a>

context Microsoft.AspNetCore.Http.HttpContext

The context.

<a name='MemoryPackHelper.MinimalApi.PackableResults.Packed_T_(Microsoft.AspNetCore.Http.HttpContext,T).res'></a>

res T

The resource.

Returns

Microsoft.AspNetCore.Http.IResult
<br/>

Example

app.MapGet("/{arg}", async (string arg, HttpContext context) =>  
            {  
                var obj = new KeyValuePair<string, string>("testKey", "testValue");  
                return PackableResults.Packed(context, res);  
            }).Produces<KeyValuePair<string, string>>(additionalContentTypes: "application/x-memorypack");  

See Also

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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
1.0.1 218 4/16/2025
1.0.0 217 4/15/2025