New Posts New Posts RSS Feed: xap files composition
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

xap files composition

 Post Reply Post Reply
Author
illidan View Drop Down
Newbie
Newbie


Joined: 02-Apr-2012
Posts: 3
Post Options Post Options   Quote illidan Quote  Post ReplyReply Direct Link To This Post Topic: xap files composition
    Posted: 02-Apr-2012 at 5:30am
Hello,
In my application I want to create several independent modules (in different assemblies), and load all of them during application startup. Most (if not all) composition frameworks allow to specify list of the parts in some kind of configuration file. My question is: how I do that in coctail? Do you have something ready to use, or i have to implement this functionality by myself?

Thanks in advance.
Back to Top
illidan View Drop Down
Newbie
Newbie


Joined: 02-Apr-2012
Posts: 3
Post Options Post Options   Quote illidan Quote  Post ReplyReply Direct Link To This Post Posted: 02-Apr-2012 at 5:35am
P.S. It is a Silverlight application.
P.P.S. You have a bug in you forum, in counting views of topic. Going into the topic and back keeps the count increase.
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 02-Apr-2012 at 5:52am
in Coktail, you can use the static method AddXap method from the composition class. 
All the logic is already implemented by Devforce and cocktail. 
Back to Top
illidan View Drop Down
Newbie
Newbie


Joined: 02-Apr-2012
Posts: 3
Post Options Post Options   Quote illidan Quote  Post ReplyReply Direct Link To This Post Posted: 02-Apr-2012 at 6:23am
AddXap exist from the beginning in MEF. The question is, do I have to implement the code which is going to configuration file, loads all file names and passing them to  AddXap method, or coctail team provide something like this out of box.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 02-Apr-2012 at 8:29am
Essentially all you need to do is call Composition.AddXap

See this article for more information http://drc.ideablade.com/xwiki/bin/view/Documentation/cocktail-dynamic-xap
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 02-Apr-2012 at 11:17am
Originally posted by illidan

AddXap exist from the beginning in MEF. The question is, do I have to implement the code which is going to configuration file, loads all file names and passing them to AddXap method, or coctail team provide something like this out of box.

No, there isn't currently anything prebuilt to eager load your modules based on a configuration file. AddXap provides the low level functionality of loading the XAP, that goes further than the standard MEF DeploymentCatalog. With Composition.AddXap you can actually have entire new domain models in the XAP you are loading and they get properly discovered and initialized. It also makes sure that the underlying ViewLocator is made aware of the new assemblies that might contain views.

Cocktail follows the convention-over-configuration principal. We rarely eager load modules. The application logic/flow should be in charge of loading a XAP when it's actually needed and not way in advance when it might never be used.

Having said that, occasionally the need arises to eager load certain modules during startup, but Cocktail currently leaves that up to the developer for how she wants to do this. The hooks are there. For example you can overload FrameworkBootstrapper.StartRuntimeAsync to perform the eager loading as part of the application's bootstrapping.

Just keep in mind that eager loading anything delays the application startup. Breaking an application into multiple XAPs is intended to speed up said startup and reduce the initial download size. Eager loading the modules kinda defeats that and the more XAPs you eager load the higher the overhead due to the multiple downloads that get initiated. It generally leads to a better user experience to defer loading. You could load in the background, but then you have to implement ugly logic that prevents the user from entering a certain module until it's loaded completely.

Just a few thoughts to ponder.

Edited by DFFadmin - 02-Apr-2012 at 11:45am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down