You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got an enum type which I've declared as a property on a model and am issuing an HTTP GET request. I found that the value being passed in wasn't binding to the model which caused the enum to be set to its default value. I decided to make the property nullable to test whether the property was being set to the default value because no value was set or because it was somehow receiving the default value and discovered that the binding started working. I then reverted the change and unregistered the HybridModelBinderApplicationModelConvention to use the default model binding and saw that value was set properly. I then tested with the hybrid model binder again, but changed the request to an HTTP POST rather than a GET and it worked properly.
So, it seems there is an issue with the hybrid model binder with Enums when the values are sent via the QueryString.
The text was updated successfully, but these errors were encountered:
derekgreer
changed the title
Enum type isn't binding
Enum type isn't binding from QueryString
Feb 17, 2017
I've got an enum type which I've declared as a property on a model and am issuing an HTTP GET request. I found that the value being passed in wasn't binding to the model which caused the enum to be set to its default value. I decided to make the property nullable to test whether the property was being set to the default value because no value was set or because it was somehow receiving the default value and discovered that the binding started working. I then reverted the change and unregistered the
HybridModelBinderApplicationModelConvention
to use the default model binding and saw that value was set properly. I then tested with the hybrid model binder again, but changed the request to an HTTP POST rather than a GET and it worked properly.So, it seems there is an issue with the hybrid model binder with Enums when the values are sent via the QueryString.
The text was updated successfully, but these errors were encountered: