Davish.Endpoints 1.2.0

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

Davish.Endpoints

Source-generator-based endpoint discovery and registration for ASP.NET Core Minimal APIs.

Instead of reflection-scanning every loaded assembly at startup to find your endpoint classes, Davish.Endpoints uses a Roslyn incremental source generator to find them at compile time and emit a plain AddEndpoints() registration method. Route mapping (including nested route groups) is then wired up once at startup via a small, bounded reflection pass over the already-resolved instances — not an assembly scan.

Install

dotnet add package Davish.Endpoints

Quick start

Define a group and one or more endpoints that belong to it:

using Davish.Endpoints;
using Microsoft.AspNetCore.Routing;

public class ApiGroup : IGroupEndpoint
{
    public RouteGroupBuilder Configure(IEndpointRouteBuilder endpoints)
        => endpoints.MapGroup("api");
}

public class PingEndpoint : IEndpoint<ApiGroup>
{
    public void AddRoutes(IEndpointRouteBuilder endpoints)
        => endpoints.MapGet("ping", () => "pong");
}

Wire it up in Program.cs:

using Davish.Endpoints;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpoints(); // generated at compile time

var app = builder.Build();
app.MapEndpoints();              // maps groups + endpoints, parents before children

app.Run();

GET /api/ping now returns pong.

Nested groups

Groups can be nested by declaring a parent via IGroupEndpoint<TParent>:

public class ApiGroup : IGroupEndpoint
{
    public RouteGroupBuilder Configure(IEndpointRouteBuilder endpoints)
        => endpoints.MapGroup("api");
}

public class AuthGroup : IGroupEndpoint<ApiGroup>
{
    public RouteGroupBuilder Configure(IEndpointRouteBuilder endpoints)
        => endpoints.MapGroup("auth");
}

public class LoginEndpoint : IEndpoint<AuthGroup>
{
    public void AddRoutes(IEndpointRouteBuilder endpoints)
        => endpoints.MapPost("login", () => Results.Ok());
}

POST /api/auth/login is mapped automatically, with ApiGroup configured before AuthGroup.

How it works

  • AddEndpoints() is generated by a source generator that scans your project for non-abstract classes implementing IEndpoint/IEndpoint<TGroup> and IGroupEndpoint/IGroupEndpoint<TParent>, and registers each one into IServiceCollection as a singleton.
  • MapEndpoints() resolves those registered instances from the DI container, inspects each instance's own generic interface arguments once (a small, fixed-size reflection pass — not an assembly scan) to determine group/parent relationships, and calls Configure/AddRoutes in dependency order.

This split keeps the expensive part (finding all your endpoint types across a potentially large codebase) at compile time, while keeping the cheap part (wiring a handful of already-resolved instances together) as ordinary, easy-to-read runtime code.

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.
  • net10.0

    • No dependencies.

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.2.0 101 8/30/2026
1.1.0 100 8/30/2026
1.0.0 94 8/28/2026