New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Results.Empty #40168
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Thanks for contacting us. We're moving this issue to the |
API review: We'll use properties instead. Here's the approved API: public static class Results
{
+ public static IResult Empty { get; } = new EmptyResult();
}
public class ControllerBase
{
+ public static EmptyResult Empty { get; } = new ();
} |
Hi @davidfowl @pranavkm, do we need to address this for MVC as well? I mean in property in ControllerBase?? |
Yep |
* feat (MVC) : Add Empty property to `ControllerBase` Contributes to #40168
Background and Motivation
Sometimes you want to return a result that does not mutate the response in anyway. This happens when you have multiple branches in a route handle and one of them should be a noop. You are forced to return an IResult and we don't have a built in result type that fills this role. Mvc has EmptyResult for this purpose.
Proposed API
Usage Examples
Alternative Designs
Force people to write their own.
Risks
None
The text was updated successfully, but these errors were encountered: