That's great and pretty close to what I have , it's good to see confirmation that the DependencyResolver is the way to inject the CMB via a ModelBinderProvider.
One thing that your example doesn't have and something I didn't/couldn't get working is the ability to read the incoming message. So rather than:
bindingContext.Model = new User() { Id = 2, Name = "foo" };
Please could you show me how you'd read the request body because I'm finding it comes out blank using the lines of code in my example.
LittleClive
Member
91 Points
65 Posts
Re: How do I add a custom ModelBinder?
Feb 20, 2012 07:40 PM|LINK
That's great and pretty close to what I have , it's good to see confirmation that the DependencyResolver is the way to inject the CMB via a ModelBinderProvider.
One thing that your example doesn't have and something I didn't/couldn't get working is the ability to read the incoming message. So rather than:
bindingContext.Model = new User() { Id = 2, Name = "foo" };
Please could you show me how you'd read the request body because I'm finding it comes out blank using the lines of code in my example.
Thanks