Minimal API Support
See original GitHub issueSeeing the recent advancements on the minimal APIs within ASP.NET Core.
It would be really cool if we could look at some extension methods that sit on top of this and provide a way to map IRequest<T>
handlers directly to http routes without having to use a controller.
I expect this would be a set of extension methods.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Minimal APIs quick reference
Provides an overview of minimal APIs in ASP.NET Core. ... The minimal APIs consist of: ... can be detected in the service provider....
Read more >Tutorial: Create a minimal API with ASP.NET Core
In this article Overview Prerequisites Create an API project Add NuGet packages The model and database context classes Add the API code Install...
Read more >Introduction to ASP.NET Core Minimal APIs
With Minimal APIs, you get a single opportunity to bind data from the request to the model. By default, it's a straightforward deserialization ......
Read more >Minimal APIs in .NET 6
The core idea behind Minimal APIs is to remove some of the ceremony of creating simple APIs. It means defining lambda expressions for...
Read more >Minimal APIs in .NET 6
In this article, we are going to explain the core idea and basic concepts of the minimal APIs in .NET 6 with examples....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I try to do something similar, with extension methods that allow to map a route to a an IRequest.
Something like that
Which will be the equivalent of
The idea is to have something similar as the original API, with less boilerplate.
The problem is that I don’t know the correct approach to use… I tried to create a dynamic delegate that wrap the original one and that adds the mediator and the token, but I don’t think it is a good approach, and I have a lack of knowledge in this domain so I struggled with lot of problems.
Maybe the most simple solution is to have a middleware that handles the IRequest, but with this solution, I don’t know how Swagger will know the actual return type of the method. I will try to dig a bit.
@vip32 No, I haven’t done anything. And I will probably wait for asp.net core 7 because the new
[AsParameters]
attribute will simplify a lot what I want to achievehttps://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-7-preview-5/