Print Page | Close Window

Controlling MEF Discovery in Desktop application

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3913
Printed Date: 05-Jun-2025 at 6:08pm


Topic: Controlling MEF Discovery in Desktop application
Posted By: -ook
Subject: Controlling MEF Discovery in Desktop application
Date 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 - 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
 



Replies:
Posted By: -ook
Date Posted: 21-Jan-2013 at 4:33pm
Nevermind, found out that adding the SearchPattern to the 'App' constructor solved the issue.
 


Posted By: kimj
Date 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.



Print Page | Close Window