-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Description
When using minimal APIs, external libraries could want to expose custom results, like views. There is no way to add custom extension methods to the Results
class. However a solution could be to expose a public property e.g. Results.Custom
that could be used to expose other types of results.
Today the only solution is for each library to create their own factory class, or return an IResult
instance directly which doesn't help for discoverability, and consistency.
Example:
app.MapGet("/", () =>
{
return LiquidResults.View("index", new Todo(1, "Go back to work!", false));
});
Which could instead become:
app.MapGet("/", () =>
{
return Results.Custom.LiquidView("index", new Todo(1, "Go back to work!", false));
});
DamianEdwards
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels