-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add Extensions to Http.TypedResults #47050
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
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 Notes:
API Approved as proposed! namespace Microsoft.AspNetCore.Http;
public static class TypedResults
{
+ public static IResultExtensions Extensions { get; } = new ResultExtensions();
} |
We might be getting extension everything in C# 12, so hopefully, this will be obsolete in the future. |
I can provide a PR with the implementation. |
Background and Motivation
TypedResults
has a very similar api asResults
, but it lacks anExtensions
property.This property would be useful for consistency, all endpoints can use
TypedResults
even when using customized results via an extension. Besides that there seem to be plans the recommend and add a codefixer for usingTypedResults
where possible. (#45217)Proposed API
namespace Microsoft.AspNetCore.Http; public static class TypedResults { + public static IResultExtensions Extensions { get; } = new ResultExtensions(); }
Usage Examples
Alternative Designs
Alternatively a new specific interface could be used instead:
Risks
When going for the proposed solution, existing extensions automatically become available, even if they are not 'Typed'.
The text was updated successfully, but these errors were encountered: