New Posts New Posts RSS Feed: Controlling MEF Discovery in Desktop application
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Controlling MEF Discovery in Desktop application

 Post Reply Post Reply
Author
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Topic: Controlling MEF Discovery in Desktop application
    Posted: 21-Jan-2013 at 4:24pm
Hello
 
I have an issue where a dll is being examined upon startup that I wish to exclude from the discovery process. I have read http://drc.ideablade.com/devforce-2012/bin/view/Documentation/discovery and have added:
 
IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Clear();
IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Add("MyDomainModel.dll");
 
To the EntityServer in the global.asax file. This works for the server side. For the desktop client (a WPF application) I am at a loss as to where to put the above code.
 
The WPF client is using Cocktail 2012, so is the AppBootstrapper (which inherits CocktailMefBootstrapper) the best place to put it? But where? All the documentation states is: "In a desktop application, set the patterns before you begin using an EntityManager or other DevForce components". I have pasted the above two lines all over the client project and it is always ignored.
 
Regards
Mark
 
Back to Top
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jan-2013 at 4:33pm
Nevermind, found out that adding the SearchPattern to the 'App' constructor solved the issue.
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jan-2013 at 6:56pm
I think the Cocktail recommendation is to put this logic in the static initializer for your AppBootstrapper, but the App constructor should be fine too.  You just need to ensure the SearchPatterns or IgnorePatterns are set before any DevForce or Cocktail initialization is done.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down