Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The difference between IModelBinder and IModelBinderProvider asp.net mvc 3

The question is simple: when should I implement IModelBinder and when IModelBinderProvider?

Thanks in advance!

like image 221
Aleksei Chepovoi Avatar asked Feb 02 '26 05:02

Aleksei Chepovoi


1 Answers

IModelBinderProvider is a factory that supplies IModelBinder implementations. For simple cases where a type always uses the same model binder you just need to use IModelBinder. You would implement IModelBinderProvider for more complex cases where you need to dynamically determine which model binder to use.

Jimmy Bogard and Brad Wilson explain it better than I can.

like image 177
Jamie Ide Avatar answered Feb 03 '26 20:02

Jamie Ide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!