Despro.Framework.Presentation.MinimalApi 2.10.3

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

Despro.Framework.Presentation.MinimalApi

The Minimal API presentation flavor of Despro Framework.

Despro.Framework.Presentation.MinimalApi specializes Despro.Framework.Presentation for Minimal API endpoints. It provides a class-based endpoint model (BaseEndpoint / IEndpoint) with automatic discovery, API-version-aware route grouping, and helpers that translate domain results into typed HTTP results wrapped in the standardized ApiResult envelope.

  • Package: Despro.Framework.Presentation.MinimalApi
  • Version: 2.10.0
  • Target framework: net10.0
  • Depends on: Despro.Framework.Presentation

Installation

dotnet add package Despro.Framework.Presentation.MinimalApi

Setup

using System.Reflection;
using Asp.Versioning;
using Despro.Framework.Presentation;
using Despro.Framework.Presentation.MinimalApi;

// shared presentation services (JWT, Swagger, CORS, Mapster, HSTS)
builder.Services.AddFrameworkPresentationWeb(builder.Configuration, "My Application", "DefaultCorsPolicy");
// minimal-API services: discovers IEndpoint implementations in the given assembly
builder.Services.AddFrameworkPresentationWebMinimalApi(
    ApiAssembly: Assembly.GetExecutingAssembly(),
    RoutePrefix: "v{version:apiVersion}/[controller]");

var app = builder.Build();
app.UseFrameworkPresentationWeb(ShowSwaggerInProduction: false);
app.UseFrameworkPresentationWebMinimalApi(new[] { new ApiVersion(1, 0) }); // maps endpoints
app.Run();

AddFrameworkPresentationWebMinimalApi scans ApiAssembly for IEndpoint implementations (registered scoped) and sets JSON options to preserve property names. UseFrameworkPresentationWebMinimalApi builds an API version set, resolves every registered endpoint and calls MapEndpoint for each.


Key components

IEndpoint / BaseEndpoint (ControllerTools)

BaseEndpoint is the abstract base for a group of endpoints. Override DefineEndpoints to map routes; the base class handles version-set binding, route grouping, tagging and OpenAPI metadata. Optional overrides:

Member Default Purpose
Route null Explicit group path; otherwise derived from the route prefix + tag.
Tag null (class name minus Endpoints) Swagger tag / route segment. The class name must end with Endpoints when no Tag is set.
GroupName null Optional group name.
Version 1.0 API version for the group.

Result helpers return strongly-typed Results<Ok<ApiResult<T>>, NoContent, BadRequest<…>, UnauthorizedHttpResult, ForbidHttpResult, NotFound<…>>:

  • CommandResult(OperationResult) / CommandResult<TData>(OperationResult<TData>)
  • QueryResult<TData>(TData) / QueryResult<TData>(OperationQueryResult<TData>)

Endpoint discovery (Utilites)

EndpointExtensions.AddAllEndpoints(assembly) registers every non-abstract IEndpoint implementation in the assembly as a scoped service.


Usage

public class ProductsEndpoints : BaseEndpoint   // class name must end with "Endpoints"
{
    protected override void DefineEndpoints(IEndpointRouteBuilder app)
    {
        app.MapPost("/", async (CreateProductCommand command, ISender sender)
            => CommandResult(await sender.Send(command)));

        app.MapGet("/{id:long}", async (long id, ISender sender)
            => QueryResult(await sender.Send(new GetProductQuery(id))));
    }
}

The endpoint is discovered automatically and mapped under v{version}/Products with the Swagger tag Products.

Exceptions

PresentationException (internal, extends the shared BasePresentationException) is thrown when an endpoint class is misnamed (does not end with Endpoints).


Project structure

Despro.Framework.Presentation.MinimalApi
├── ControllerTools/            # IEndpoint, BaseEndpoint
├── PresentationExceptions/     # PresentationException
├── Utilites/                   # AddAllEndpoints (discovery)
├── FrameworkPresentationWebDi.cs     # AddFrameworkPresentationWebMinimalApi
└── FrameworkPresentationWebUseApp.cs # UseFrameworkPresentationWebMinimalApi
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
2.10.3 99 9/8/2026
2.10.2 127 7/18/2026
2.10.1 116 7/2/2026
2.10.0 120 7/2/2026