Can I have many controllers in a module?

Jun 15, 2007 at 1:02 PM
Hi.

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.

Thanks

Rafael L.
Jun 15, 2007 at 1: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.

Regards,

Dave

__________________________________

David Hayden
Microsoft MVP C#
Jun 15, 2007 at 1: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.

Regards
Benny
Jun 20, 2007 at 7: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
http://staff.southworks.net/blogs/lpanaro