<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Get access to the MEF catalog</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Get access to the MEF catalog</description>
  <pubDate>Fri, 10 Apr 2026 19:12:03 -700</pubDate>
  <lastBuildDate>Tue, 20 May 2014 12:04:13 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=4699</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Get access to the MEF catalog : As with every dependency, you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4699&amp;PID=17551#17551</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 4699<br /><strong>Posted:</strong> 20-May-2014 at 12:04pm<br /><br />As with every dependency, you just need to make the catalog available through MEF so you can inject it where you need it. Here's how you can accomplish this.<div><br></div><div><div>&nbsp; &nbsp; public class AppBootstrapper : CocktailMefBootstrapper&lt;MainViewModel&gt;</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; private ComposablePartCatalog _catalog;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected override ComposablePartCatalog PrepareCompositionCatalog()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Hang on to the catalog</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _catalog = base.PrepareCompositionCatalog();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected override void PrepareCompositionContainer(CompositionBatch batch)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; base.PrepareCompositionContainer(batch);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Add catalog to the MEF container</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; batch.AddExportedValue(_catalog);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &#091;Export&#093;</div><div>&nbsp; &nbsp; public class MainViewModel : Screen</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;ImportingConstructor&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public MainViewModel(ComposablePartCatalog catalog)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div></div>]]>
   </description>
   <pubDate>Tue, 20 May 2014 12:04:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4699&amp;PID=17551#17551</guid>
  </item> 
  <item>
   <title>Get access to the MEF catalog :  Hi,I have a scenario with cocktail...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4699&amp;PID=17550#17550</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4699<br /><strong>Posted:</strong> 07-May-2014 at 7:52am<br /><br />Hi,<div><br></div><div>I have a scenario with cocktail where I need to get access to the Mef Catalog to query the Part property (http://stackoverflow.com/questions/23497474/how-to-know-the-original-type-of-a-class-exported-as-an-interface-in-mef).</div><div><br></div><div>I need this information to implement the TargetGuard method of the INavigator. I check if an attribute decorate (or not) the class to allow (or refuse) the navigation.</div><div><br></div><div>I understand why it's not possible to publish this property as it's MEF dependant and the&nbsp;ICompositionProvider is "universal" for all type of IoC.&nbsp;<span style="line-height: 1.4;">But it's in some case really annoying to not have access to the catalog.</span></div><div>I also know I could write my own implementation of MEF and give it to cocktail but it looks it's a lot of work (need to redo the bootstrapper too) for just a small thing (in my point of view).</div><div><br></div><div>Could it be possible to add a class (dedicated to MEF) on Cocktail which, like EntityAspect.Wrap(), could wrap the cocktail MEF implementation and publish the Catalog ?</div><div><br></div><div>Right now I have a workaround but it's far to be clean. in the TargetGuard method, I create a new AggregateCatalog and fill it with the loaded assemblies. It would be nicer to use the catalog present in Cocktail</div><div><br></div><span style="font-size:10px"><br /><br />Edited by kdev - 07-May-2014 at 7:55am</span>]]>
   </description>
   <pubDate>Wed, 07 May 2014 07:52:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4699&amp;PID=17550#17550</guid>
  </item> 
 </channel>
</rss>