DKNet

DKNet.AspCore.Extensions

Endpoint discovery, request binding and HTTP helpers for .NET developers building DKNet minimal APIs.

✨ Why use it?

πŸš€ Quick Start

Use a .NET 10 ASP.NET Core project.

dotnet new web -f net10.0 -n PackageDemo
cd PackageDemo
dotnet add package DKNet.AspCore.Extensions

Replace Program.cs with the example, then run dotnet run.

using DKNet.AspCore.Extensions;
using DKNet.AspCore.Extensions.Endpoints;
using Microsoft.AspNetCore.Routing;

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UseEndpointConfigs(o =>
{
    o.EnableVersioning = false;
    o.RequireAuthorization = false;
}, typeof(PingEndpoints).Assembly);
await app.RunAsync();

public sealed class PingEndpoints : IEndpointConfig
{
    public string GroupEndpoint => "/ping";
    public void Map(RouteGroupBuilder group) => group.MapGet("/", () => "pong");
}

Request GET /ping/ to see pong. This local example explicitly disables versioning and authorization. Normal defaults require AddApiVersioning() and host authentication/authorization setup.

πŸ—οΈ Architecture

The consumer host chooses endpoint groups and mapper families, contextual resolvers, response conversion and explicit middleware guards.

These helpers run inside the consumer’s ASP.NET Core process. Contextual resolvers are scoped; the host supplies authentication, authorization policies, bus handlers, repository configuration and external databases. Middleware helpers use keyed registration markers; MarkFeatureAdded and IsFeatureAdded are public marker utilities, not middleware execution.

πŸ”„ How it works

UseEndpointConfigs checks versioning, discovers configs and builds each group with population, host filters, authorization and routes.

Versioning is enabled by default and checked before discovery. The Quick Start opts out explicitly. A declared contextual member requires population registration and a setter; missing setup fails when endpoint metadata is built.

🧩 Features