Multi View and One Controller

Topics: Web Client Software Factory, UIP Application Block discussion, User Forum
Sep 8, 2007 at 2:50 PM
Hi All

If I have two views and use same controller. And It uses service dependency approach. how many instance will be created for the controller (one or two) if two views are being created?

regards
Alex
http://princehcan.blogspot.com
Sep 9, 2007 at 3:51 AM
Hi Alex,
Im not sure exactly your scenario. Are you referring to how many service instances will be created for the same service (service depency) in different controller instances, or how many controller instances will be created for 2 views (presenters) ?

Controllers: By default your presenters should be using the CreateNew attribute to instantiate the controller, so you would have two controller instances, one for each view.

Services: Services being injected into the controller will live in a container at the application level (module or global) and will be created once during intialization. Your controllers will be injected with the same service instance.

Jarod Ferguson
Sep 9, 2007 at 6:46 AM
Hi Jarod Ferguson

Thanks. I want to ask how many controller instances will be created for two views and you have answered my question.

Besides, thanks for your clarification of the Services life cycle and it is very useful for me.

Regards
Alex
http://princechan.blogspot.com