Giter Site home page Giter Site logo

marcominerva / minimalhelpers Goto Github PK

View Code? Open in Web Editor NEW
90.0 6.0 3.0 113 KB

A collection of helpers libraries for Minimal API projects.

License: MIT License

C# 88.48% PowerShell 11.52%
aspnetcore minimalapi minimalapis minimal-api hacktoberfest net routing openapi swagger csharp

minimalhelpers's Issues

Provide a static abstract interface method to register endpoints

Currently, the library requires that we implement the IEndpointRouteHandler interface and, at runtime, reflection is used to instantiate the class in order to call the MapEndpoints method. With .NET 7.0, we can provide an alternative method to endpoint registration using static abstract interface members. The proposal is to add the following interface and the corresponding extension method to the library:

public interface IStaticEndpointRouteHandler
{
    static abstract void MapEndpoints(IEndpointRouteBuilder endpoints);
}

public static void MapEndpoints<T>(this IEndpointRouteBuilder endpoints) where T : IStaticEndpointRouteHandler
{
     // ...
}

In this way, we can register our handler using a syntax like this:

app.MapEndpoints<PeopleHandler>();
app.MapEndpoints<ProductsHandler>();

And no reflection at all will be involved in the registration process.

The question is: giving this new behavior, do you think that IStaticEndpointRouteHandler is a good name for the new interface?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.