Composite app with Prism for WinRT

Apr 1, 2014 at 7:56 PM
Edited Apr 1, 2014 at 8:00 PM
Hi,
We are using prism for WinRT for building a business app and we need to build It as a composite application. We know about the restrictions for composite apps in the Windows store.
However we expect to build our applications with multiple independant projects. This is to allow different teams to work on each one and by this way ensure that there will be no dependencies between each other. The package to deploy will be built with compositions of these projects before pushing it on a store (probably an enterprise store).
Is it possible to do such work with prism, that would mean having many view projects and view model projects in the same solution sharing a same application base that will hold shared services like navigation, DI container, Viewmodel locator, event aggregator...
Would it mean using a custom naming conventions, or just different namespace....
What should we be carefull in such a strategy ? Would it be possible to use different app domains for our "blocs" to keep a good isolation if one of it has problems ?
Thank you for your answer and advices
Regards
SB
Apr 2, 2014 at 7:46 AM
I know this isn't exactly an answer to what you asked. If these "applications" are to be developed totally isolated why dont you leave them that way and create sharing contracts that each uses? Not sure if that will work in your scenario, just a thought.
Apr 2, 2014 at 2:20 PM
If you mean sharing contracts from the charms, it was our first thinks but it has too many limitations.
It is not possible to jump from one app to another by using charm contracts. We also look at the protocols activation, but it is also made of limitations...
That's why we are looking to build a composite application. The target is not to change any bloc dynamically, but to allow us to build beforehand the definitive app by composition of our blocks with best practices and patterns...
Apr 5, 2014 at 12:44 AM
Ah, thanks for clarifying. Are you aware that in Win 8 the CLR will only load assemblies when a method is executed that contains a reference to that assembly? Therefore it is possible to add many 3rd party references into your application, but only if a method is invoked that contains a call to a 3rd party method will that assembly be loaded. In effect we have lazy loading of assemblies right out of the box.

To try this create a class DLL with a method on it, reference it in your many application. put a breakpoint on DoSomething to ensure it is not run:
namespace ThirdPartyAssembly
{
public class Dummy
{
public bool DoSomething()
{ return true; }
}
}

Now in you many Win 8 app, in App.xaml.cs OnLaunched event, add the following code

if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
var dummy = new ThirdPartyAssembly.Dummy();
dummy.DoSomthing();
}

You will see (in the output window) that when you run the app, that the ThirdPartyAssembly is loaded even though the method was not executed. This is because the reference was in the executed method (OnLaunched). By moving that reference into another method that is not executed, the dll will no longer be loaded.

Move those two lines into a new method in App.xaml.cs:
void CallThirdParty()
{
var dummy = new ThirdPartyAssembly.Dummy();
dummy.DoSomthing();
}

and call that method from the original OnLaunched method:
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
CallThirdParty();
}

This time because the reference is no longer in an executing method, the assembly will not be loaded.

This should give you your composite behaviour, and even do the lazy loading for you with no extra effort.