Hi Jeff
Was experimenting with registering ModelBinders.
Am I correct in understanding that there are two options for
registering the SubControllerBinder.
Either as the default binder...
ModelBinders.DefaultBinder = new SubControllerBinder();
Or by registering each SubController derived type?
ModelBinders.Binders[typeof(FirstLevelSubController)] = new
SubControllerBinder();
ModelBinders.Binders[typeof(SecondLevelSubController)] = new
SubControllerBinder();
...
I was tempted to try and register the SubController base class.. but
it didn't work. In Scott Guthrie's Preview 5 post.. he mentioned that
there were still a few changes coming to ModelBinders. Could
supporting the registering of a base class be one of them?
On Sep 8, 9:15 am, "Jeffrey Palermo" <Jeff...@Palermo.cc> wrote:
> Guys,
> I'm still hoping that SubControllers make it into the MVC Framework release,
> but my company is doing several client projects right now using the MVC
> Framework. These projects are enterprise applications, not smaller
> websites, so subcontrollers are absolutely necessary to handle the complext
> logic and permissions. I've create an implementation of subcontrollers and
> added it to MvcContrib. It is pulling its weight on one client project, so
> I'm happy with it. It can be made better, and I'm hoping the team can take
> my first draft and incorporate it into the product.
>
> Here is the revision that added SubController support to MvcContrib:
http://code.google.com/p/mvccontrib/source/detail?r=508
>
> I have included a full sample with 3 levels of nested subcontrollers and an
> example of a nested subcontroller owning a form and posting to itself
> without the parent controllers caring:
http://code.google.com/p/mvccontrib/source/browse/trunk/src/Samples/M...
>
> Feel free to pull down the source and let me know what you think. Even
> better, if you find an idea for improvement, please submit a patch.
>
> I have leveraged the IModelBinder so that subcontrollers can be passed
> directionly into action methods, and you can hook your IoC container up so
> that it creates the subcontrollers and the dependencies.
>
> Decomposing complex screens infinitely increases maintainability, so this is
> why I consider subcontrollers a critical feature.
>
> Even if this doesn't make it into the product, the team has done a good job
> making the framework extensible, so I was able to implement subcontrollers
> in less than 150 lines of code. I welcome your thoughts and opinions.
>
> You can pull down the source for MvcContrib by pointing your TortoiseSVN
> client tohttp://
mvccontrib.googlecode.com/svn/trunk/Note that this is a