Open Luke1979 opened 4 years ago
I suspect it's a limitation of the framework to only execute the first successful instance of IModelBinder
. HybridModelBinding
registers itself as the first MvcOptions.ModelBinderProviders
via AddHybridModelBinder
.
However, I've had an idea before to create public-facing methods for adding model binders through HybridModelBinding
to continue hydrating properties of the parent-instance (currently, this is all handled internally). Need to think about implementation a bit more since ordering of events becomes more important.
Hi Bill,
We've been using this package for a new project we're working on and it's been super helpful, sadly we've now come across this limitation as well.
Is this something that is being actively looked at? Are you open to some help implementing this? If so please let me know as I'd be keen to get this added to the package!
Cheers
Hi all,
Great nuget package; thanks.
Is it possible to combining
HybridModelBinder
with another CustomIModelBinder
.My
Request
class has a complex type (Company
) which I'm attempting to resolve usingCompanyModelBinder
in the example below. If I use[FromQuery]
it all works, but changing to[FromHybrid]
prevents the model binder from being hit.Any help/info would be great.
CompanyModelBinder.cs
Startup.cs
....Request.cs
Controller.cs
Using
[FromQuery]
works (The Company model binder is invoked)...but using [FromHybrid]` doesn't.... :(
Any ideas what I might be doing wrong?
Thanks.