C#C
C#2y ago
Maskoe

minimal api DI magic

Why does the upper one work, but the lower one doesnt?

v1.MapGet("/lmao4", (HttpContext context) => // Executes and returns 4444.
{
    Console.WriteLine("4");
    return TypedResults.Ok("444");
});
v1.MapGet("/lmao3", GetAllTodos); // Executes, but doesnt return 333.

app.Run();

static async Task<IResult> GetAllTodos(HttpContext context)
{
    Console.WriteLine("3");
    return TypedResults.Ok("333");
}
Was this page helpful?