-
Notifications
You must be signed in to change notification settings - Fork 107
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
✨ Result Status Helpers #176
Comments
If you don't see an issue with the If you opt to use IResult, create a new class Confirm you're still interested in the PR and I'll assign this to you (or just submit the PR if that's quick). Thanks! |
@ardalis @danielmackay This could be solved by adding the methods to public static bool IsUnauthorized(this Result result)
=> result.Status == ResultStatus.Unauthorized;
public static bool IsForbidden(this Result result)
=> result.Status == ResultStatus.Forbidden; These two are examples, if you think it is the correct way to do it I would be happy to make my contribution. |
Hey @ardalis. Thanks for the reply! Yes I am still interesting in actioning this PR. Please assign to me and I will aim to get it done over the next week. Cheers! |
@ardalis I ended up opting for the extension methods to be agains |
Pain
When checking the result status (for example a service called from a minimal API). The code seems more verbose that it could be.
For example:
Solution
Add helper fields to
IResult
so that the code is more concise. The result would look something like:The above reads much cleaner and removes unneeded code.
@ardalis:
IResult
is the best place to put this?The text was updated successfully, but these errors were encountered: