Tolitech.Presentation.API.Generators.Abstractions
1.0.0-preview.1
dotnet add package Tolitech.Presentation.API.Generators.Abstractions --version 1.0.0-preview.1
NuGet\Install-Package Tolitech.Presentation.API.Generators.Abstractions -Version 1.0.0-preview.1
<PackageReference Include="Tolitech.Presentation.API.Generators.Abstractions" Version="1.0.0-preview.1" />
<PackageVersion Include="Tolitech.Presentation.API.Generators.Abstractions" Version="1.0.0-preview.1" />
<PackageReference Include="Tolitech.Presentation.API.Generators.Abstractions" />
paket add Tolitech.Presentation.API.Generators.Abstractions --version 1.0.0-preview.1
#r "nuget: Tolitech.Presentation.API.Generators.Abstractions, 1.0.0-preview.1"
#:package Tolitech.Presentation.API.Generators.Abstractions@1.0.0-preview.1
#addin nuget:?package=Tolitech.Presentation.API.Generators.Abstractions&version=1.0.0-preview.1&prerelease
#tool nuget:?package=Tolitech.Presentation.API.Generators.Abstractions&version=1.0.0-preview.1&prerelease
Tolitech.Presentation.API.Generators.Abstractions
Overview
This project provides an abstraction for endpoint definition in ASP.NET applications, making it easier to standardize and automatically register HTTP routes. The main goal is to allow endpoints to be defined via interfaces, promoting organization and extensibility.
Main Interface
public interface IEndpoint
{
static abstract void MapEndpoint(IEndpointRouteBuilder app);
}
- IEndpoint: Interface to be implemented by classes representing endpoints. The static
MapEndpoint
method is responsible for registering routes in the application's pipeline.
How to Use
- Implement the IEndpoint interface:
using Tolitech.Presentation.API.Generators.Abstractions;
using Microsoft.AspNetCore.Routing;
public sealed class MyEndpoint : IEndpoint
{
public static void MapEndpoint(IEndpointRouteBuilder app)
{
app.MapGet("/my-endpoint", () => "Hello, world!");
}
}
- Use the generator to automatically register all endpoints:
When used together with Tolitech.Presentation.API.Generators, all endpoints implementing IEndpoint
will be automatically registered.
Benefits
- Standardization of endpoint definitions
- Easier testing and maintenance
- Integration with code generators
Requirements
- ASP.NET Core
Examples
Below is an example of implementation and registration:
public sealed class TestEndpoint : IEndpoint
{
public static void MapEndpoint(IEndpointRouteBuilder app)
{
app.MapGet("/test", () => "Testing endpoint!");
}
}
When running the application, the /test
endpoint will be available automatically if the generator is used.
Notes
This project is intended to be used together with Tolitech.Presentation.API.Generators for automated endpoint registration.
Product | Versions 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. |
-
net9.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.0.0-preview.1 | 85 | 7/27/2025 |