-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
SmartEnum binding to [FromQuery] parameters #410
Comments
Sorry this doesn't directly answer your question, but I've managed to find a workaround by making my [FromQuery] object use a string type... It's not as clean, but it does the job. on my Controller:
The request type:
The EF query (or any other use)
|
@laska-u, when the data is not really a JSON coming from a request body, the JsonConverters are not executed. I just encountered the same issue, and there are two options that worked for me:
You can also use a custom model binder, but I didn't try that option as it's not needed. @ardalis, should any of these options be added into the library? I'm open on contributing if you agree. |
@miroslavgrozdanovski Sure, that would be great. I probably need to improve the docs for SmartEnum some time as well, to cover things like this that aren't necessarily "in the box"... |
I have a controller that binds string parameters from GET request into a class object.
I tried to use JsonConverter attributes with SmartEnum name serialization to automatically bind some parameter to a SmartEnum objects but it always NULL. Is there a workaround in this situation?
The text was updated successfully, but these errors were encountered: