372 questions
Best practices
4
votes
2
replies
114
views
Is using #region acceptable to organize 30+ endpoints in a .NET Core Minimal API?
I have a .NET Core minimal API that has grown to 45+ MapGet/MapPost endpoints in Program.cs, and it's becoming difficult to navigate. All endpoints share several variables declared in Program.cs (...
-1
votes
0
answers
96
views
Swagger doesn't come up when I start debugging
I've used Swagger for several ASP.NET Core applications, and it works fine. So, I don't understand why it isn't coming up now in a new Blazor app I'm working on. The Blazor Web Application I've been ...
3
votes
1
answer
79
views
Neat way to get request in Minimal API endpoint filter
In endpoint filters, I often want to get the request, for example FooRequest. I know there will be only one of these in the arguments list, so using GetArgument that requires passing an index integer ...
1
vote
1
answer
91
views
Connection is closed when accessing Minimal Web API
I have a WPF app that host a Minimal Web API. To start the Minimal Web API, the following code is used:
public async Task StartWebApi(IEnumerable<string> urls, CancellationToken token)
{
var ...
1
vote
2
answers
105
views
Replacing IServiceProvider in ASP.NET Core minimal API
I am attempting to migrate an ASP.NET Core application from using IWebHostBuilder to WebApplicationBuilder.
I understand that you can no longer call UseStartup.
One useful thing about the old model ...
0
votes
0
answers
65
views
How can I apply these attributes in F# ASP.NET minimal APIs?
I'm trying to convert this C# example from the .NET Minimal APIs Quick Reference that sets up a keyed service.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKeyedSingleton<...
4
votes
1
answer
119
views
Minimal API: Dictionary<string, string> always null when sending data with IFormFile via multipart/form-data
I’m using ASP.NET Core Minimal API. I have an endpoint where I want to receive an IFormFile along with a Dictionary<string, string> property in the same request. I set the Accepts<...
1
vote
1
answer
77
views
Cant create a public class in app.MapGet in Minimal api app
app.MapGet("/bus_schedule", (string user_stop_name, string user_route) =>
{
public class Bus
{
public string[3] arrival_time { get; set; }
public string route { ...
1
vote
1
answer
50
views
OutputCache but still going into code in Minimal API
I am trying to get cache working on my API call but every time I do a request it goes straight into my lookup service code.
I have two services, stock and productlookup. The stock calls the ...
0
votes
1
answer
72
views
Minimal API: PageResult<T> not returning OData-style JSON with @odata.count and value
I’m building a .NET 8 minimal API endpoint that returns paginated results using OData. My service method returns a PageResult like this:
public async Task<PageResult<ItemDto>> GetItemList(...
0
votes
1
answer
94
views
Can I run ASP.NET Core Minimal API and Azure Functions in the same project locally?
I'm working on a backend that uses both ASP.NET Core Minimal API and Azure Functions (TimerTrigger and HttpTrigger). I want to run both locally for development and testing.
However, I'm running into ...
1
vote
1
answer
190
views
After publishing, Swagger loads but doesn't display any endpoint
During local development, my ASP.NET Core 8 Minimal API project is operating without any issues. Swagger opens at /swagger, all endpoints are visible, and everything is testable directly from the user ...
1
vote
0
answers
157
views
How do you turn off caching in a Minimal API?
I have written a Minimal API in C# running on .NET 8. It is supposed to return a single record and update a table in our database, indicating that a record has been processed. The nature of the ...
0
votes
1
answer
47
views
Blazor server connection disconnected error when sending Excel file as streamcontent to ASP.NET Core Minimal API endpoint
I am using Telerik Blazor TelerikFileSelect component to select an excel file and send it as a StreamContent to ASP.NET Core Minimal API endpoint. I do not see any issues when I send a 13 KB Excel ...
2
votes
0
answers
93
views
Validation and the required modifier
I'm working on an ASP.NET Core Minimal API. We are using the MiniValidation library for request validation on our endpoints. We have some strict linting that means for reference types we need to ...