Can I have many controllers in a module?

Jun 15, 2007 at 12:02 PM

Can I have many controllers in a module? I think that if I put all code in only one controller it will be very complex.
Simple example: The EFTModule of GlobalBank Sample (WCSF) use a controller to do the transfers and to add Accounts. In this example, could I separate them in two controllers?
Correct me if I´m wrong.


Rafael L.
Jun 15, 2007 at 12:34 PM
Yes, you can have as many controllers as you want.

In the real world you rarely get away with using a Facade Controller as done in the GlobalBank Example. Many times you need to create multiple controllers, based on use-case, etc.




David Hayden
Microsoft MVP C#
Jun 15, 2007 at 12:46 PM
There is no problem having as many controllers as you wish in your module.

You just add the right controller to the different presenters you have and it should work.

Jun 20, 2007 at 6:55 PM
Hi Rafael,

Yes, you can actually split your controller and then decide which one to inject. You can play with this with the GlobalBank application, by creating a second controller under the EFTModule, copy some of the functionality of the original controller, and then inject it into one of the presenters.

Hope it helps!

Luciano G. Panaro