Guidance for passing startup args to a module

Topics: Prism v2 - Silverlight 2, Prism v2 - WPF 3.5
Jun 20, 2009 at 12:23 AM

I'm wondering what the suggested approach is for passing initialization parameters to a module?  Eg. if you want the Module's Initialize method to react in different ways based on some kind of startup state.

When the ModuleManager loads a module, the parameterless Initialize() method is invoked, and there doesn't seem to be a formal way to inject starup parameters into the Module.

Should that be passed via a "Shared Service" perhaps?  Or is there a better way to do this?

--

Thanks

Phil

Jun 23, 2009 at 7:30 PM

Hi Phil,

 

One of the possible ways could be, as you mentioned, through a “Shared Service”. This service, let’s call it State of the application, could be registered in the container at startup (probably as a Singleton since the application shares the same state).

Then you could resolve the State through the container and modify it in different places of your application. Afterwards, you will be able to perform different initializations based on it.

 

Remember that you should always keep your application decoupled, so the information kept in the state should not break the decoupling.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

Jun 23, 2009 at 8:39 PM
Great, thanks Damian.

That's helpful confirmation of this approach...nice to know I'm not off in the weeds.  Cheers!



On Tue, Jun 23, 2009 at 11:30 AM, dschenkelman <notifications@codeplex.com> wrote:

From: dschenkelman

Hi Phil,

 

One of the possible ways could be, as you mentioned, through a “Shared Service”. This service, let’s call it State of the application, could be registered in the container at startup (probably as a Singleton since the application shares the same state).

Then you could resolve the State through the container and modify it in different places of your application. Afterwards, you will be able to perform different initializations based on it.

 

Remember that you should always keep your application decoupled, so the information kept in the state should not break the decoupling.

 

Please let me know if this helps.

 

Damian Schenkelman

http://blogs.southworks.net/dschenkelman

Read the full discussion online.

To add a post to this discussion, reply to this email (CompositeWPF@discussions.codeplex.com)

To start a new discussion for this project, email CompositeWPF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com