<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Emad Ibrahim - Latest Comments in Use ModelBinder to Generically Bind Complex Types</title><link>http://emadibrahim.disqus.com/</link><description></description><atom:link href="https://emadibrahim.disqus.com/use_modelbinder_to_generically_bind_complex_types/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Sun, 07 Sep 2008 18:38:35 -0000</lastBuildDate><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2219689</link><description>&lt;p&gt;Well how about this:&lt;/p&gt;&lt;p&gt;I exposed the protected UpdateModel in my controller:&lt;/p&gt;&lt;p&gt;        public void UpdateModel(BusinessSavingsRequest bsr, string[] keys)&lt;br&gt;        {&lt;br&gt;            base.UpdateModel(bsr, keys);&lt;br&gt;        }&lt;/p&gt;&lt;p&gt;and then call it from my binder:&lt;/p&gt;&lt;p&gt;        public object GetValue(ControllerContext controllerContext, string modelName, Type modelType, ModelStateDictionary modelState)&lt;br&gt;        {&lt;br&gt;            BusinessSavingsRequest bsr = new BusinessSavingsRequest();&lt;br&gt;            string[] properties = typeof(BusinessSavingsRequest).GetProperties().Select(p =&amp;gt; p.Name).ToArray();&lt;br&gt;            ((MvcApplication.Controllers.BusinessSavingsController)controllerContext.Controller).UpdateModel(bsr, properties);&lt;br&gt;            return bsr;&lt;br&gt;        }&lt;/p&gt;&lt;p&gt;Perhaps if this is all it needed to do I wouldnt have a custom binder for the type.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Edwards</dc:creator><pubDate>Sun, 07 Sep 2008 18:38:35 -0000</pubDate></item><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2108253</link><description>&lt;p&gt;The ComplexModelBinder doesn't make much sense in his post.&lt;/p&gt;&lt;p&gt;How do you use it?  Why the need to 'register' it.&lt;/p&gt;&lt;p&gt;Seems to me if you pass a complex type as a parameter, it would map the form variables to the type with reflection - and only if you need to have more complex mapping would you create a specific binder...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Steve</dc:creator><pubDate>Thu, 04 Sep 2008 12:33:03 -0000</pubDate></item><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2033611</link><description>&lt;p&gt;Yeah, I love Disqus... I actually don't have to log in to my admin tool to&lt;br&gt;moderate my comments.  I simply reply to a comment with "approve" and it&lt;br&gt;gets approved.  Or If I reply with some other text, it approves the comment&lt;br&gt;and submits my text as a comment.  Very neat.&lt;br&gt;I am looking into the ComplexModelBinder and trying to get things working&lt;br&gt;with the built-in stuff :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Emad</dc:creator><pubDate>Wed, 03 Sep 2008 14:57:18 -0000</pubDate></item><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2033291</link><description>&lt;p&gt;No problem :)&lt;br&gt;btw: this threaded comment view is awesome&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simone Chiaretta</dc:creator><pubDate>Wed, 03 Sep 2008 14:37:23 -0000</pubDate></item><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2033063</link><description>&lt;p&gt;You are absolutely right.  It is hard to find these things without good&lt;br&gt;documentation.  But I just  found some info at&lt;br&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx" rel="nofollow noopener" target="_blank" title="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx"&gt;http://weblogs.asp.net/scot...&lt;/a&gt;&lt;br&gt;I will update the post to direct readers there.&lt;/p&gt;&lt;p&gt;Thanks for the heads up.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Emad</dc:creator><pubDate>Wed, 03 Sep 2008 14:21:15 -0000</pubDate></item><item><title>Re: Use ModelBinder to Generically Bind Complex Types</title><link>http://www.emadibrahim.com/2008/09/03/use-modelbinder-to-generically-bind-complex-types/#comment-2032909</link><description>&lt;p&gt;Isn't this what the ComplexBinder that comes with MVC P5 already does?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simone Chiaretta</dc:creator><pubDate>Wed, 03 Sep 2008 14:08:40 -0000</pubDate></item></channel></rss>