-
Notifications
You must be signed in to change notification settings - Fork 133
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
Sieve does not work with asp.net core minimal API's #181
Comments
I was able to reproduce the issue. Is there an update on this issue? |
Not to my knowledge. I worked around this problem by creating a wrapper class: public class SieveWrapper
{
[UsedImplicitly]
[FromQuery]
public string? Filters { get; set; }
[UsedImplicitly]
[FromQuery]
public string? Sorts { get; set; }
[UsedImplicitly]
[FromQuery]
public int? Page { get; set; }
[UsedImplicitly]
[FromQuery]
public int? PageSize { get; set; }
protected SieveModel GetSieve() => new()
{
Filters = Filters,
Sorts = Sorts,
Page = Page,
PageSize = PageSize
};
} |
Oh, that's smart. I tried writing a static extension method that would provide the missing TryParse. Unfortunately, .NET doesn't pick it up. I guess it was worth a try. Now that I'm seeing your solution, I feel bad for not even thinking about just wrapping the class. Oof. Thanks for your response, I greatly appreciate a solution that doesn't require me to use FromBody haha |
Describe the bug
The new asp.net core minimal api's are not able to handle the
SieveModel
To Reproduce
Steps to reproduce the behaviour:
app.MapGet("/test", ([FromQuery] SieveModel model) => { });
/test
endpointExpected behaviour
The app starts and binds the
SieveModel
Actual behvaiour
Exception is thrown:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: