Proposed Changes for RTM: WorkItem initializers

Topics: CAB & Smart Client Software Factory
Aug 18, 2005 at 5:44 AM
originally posted by: EdJez

Hi - here's one of the things we're thinking of improving for RTM. If you can, please tell us whether you would consider this an improvement and/or other considerations.

The problem we are trying to solve is about startup. Right now you have module initializers that start very early in the app lifecycle. It's unclear though how the initializer code affects the application's structure if you want to, for example, add smartparts to a workItem, load state etc. Who creates the workItem? How do you find it starting with the apphost? What happens if you need initialization to run later during the app when some other workitem started? Etc.

continues..>
Aug 18, 2005 at 5:51 AM
originally posted by: EdJez

One of the proposals is to have 'workItem' initializers. These would be components you write where you can override methods related to workitem lifecycle (Start, Activate, Deactivate..). The important thing is that CAB itself would, on workitem start, create instances of these components, add them to the workitem, and later callthe appropriate methods.

The workitem initializer would specify via config, or via an attribute, which workItem type(s) it needs
to be started in.

This would let you add things into a workitem, at whichever time the worktem starts, without having a reference from the workitem to your component or assembly that will be started there.

What issues have you faced in trying to do the stratup of the application? Would this help? What have you tried?
Aug 18, 2005 at 3:37 PM
originally posted by: JGlynn

This sounds like a good start. Would the Module.Initializer still be called at app startup? This is where I have concerns. Think of large scale app that may have many modules. Some of these modules may not be used depending on whatthe user needs or the type of user logged in. It would be nice to be able to delay the Module.Init process until the module is needed. Global application process (services, events etc) can be assigned a "Global Module" that is started at app startup. Then modules are loaded on demand.

I know this alters some of the plumbing that is being done, but to me it feels a little better.
Aug 25, 2005 at 7:06 PM
originally posted by: jwalklin

Great!

I'm struggling with this very issue with the CAB CTP. I have a subclass of ComponentMonitor that I want to add to every WorkItem. It seems my only options are subclassing WorkItem or adding the ComponentMonitor explicitly to every WorkItem. Am I missing something?

(If I'm not missing something ...) Customizing WorkItem initialization, similar to the way the modules can be dynamically loaded by the ApplicationHost, would solve this.