<?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 : MEF and GlobalCache</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : MEF and GlobalCache</description>
  <pubDate>Fri, 10 Apr 2026 19:11:19 -700</pubDate>
  <lastBuildDate>Mon, 03 Sep 2012 21:57:49 -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=3603</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>MEF and GlobalCache :   Of course, such a silly oversight....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14318#14318</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=131" rel="nofollow">-ook</a><br /><strong>Subject:</strong> 3603<br /><strong>Posted:</strong> 03-Sep-2012 at 9:57pm<br /><br />Of course, such a silly oversight. Sorry, I am&nbsp;quite new to MEF and all these levels of abstraction&nbsp; are difficult to follow - it is all smoke and mirrors to me at the moment.<div>&nbsp;</div><div>Thankyou for the quick reply.</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Mon, 03 Sep 2012 21:57:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14318#14318</guid>
  </item> 
  <item>
   <title>MEF and GlobalCache : Where&amp;#039;s your export for ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14317#14317</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> 3603<br /><strong>Posted:</strong> 03-Sep-2012 at 9:31pm<br /><br />Where's your export for&nbsp;<span style="font-family: C&#111;nsolas; font-size: 13px; line-height: normal; : rgb251, 251, 253; ">IEntityManagerProvider</span><span style="font-family: C&#111;nsolas; font-size: 13px; line-height: normal; : rgb251, 251, 253; ">&lt;</span><span style="font-family: C&#111;nsolas; font-size: 13px; line-height: normal; : rgb251, 251, 253; ">AdventureWorks2008R2Entities</span><span style="font-family: C&#111;nsolas; font-size: 13px; line-height: normal; : rgb251, 251, 253; ">&gt;? See the EntityManagerProviderFactory in TempHire.</span>]]>
   </description>
   <pubDate>Mon, 03 Sep 2012 21:31:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14317#14317</guid>
  </item> 
  <item>
   <title>MEF and GlobalCache :   uploads/131/Test.zipHello  I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14304#14304</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=131" rel="nofollow">-ook</a><br /><strong>Subject:</strong> 3603<br /><strong>Posted:</strong> 03-Sep-2012 at 5:38am<br /><br /><font size="3" face="Times New Roman"><a href="uploads/131/Test.zip" target="_blank">uploads/131/Test.zip</a></font><p style="margin: 0cm 1.5pt 0.75pt; line-height: normal;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><font size="3"><font face="Calibri">Hello<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></font></font></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0.75pt 1.5pt; line-height: normal;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><font size="3"><font face="Calibri">I am having anissue with the MEF instantiation of the IGlobalCache class (from TempHire) whendefined as a parameter to a ViewModel constructor. To illustrate I have createda very simple test application (attached). It contains one viewmodel (no associatedview as it is unimportant at this stage), the IGlobalCache interface andderived class GlobalCache and a Entity model obtained by a few tables from theAdventureworks 2008 R2 sample database from Microsoft.<o:p></o:p></font></font></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0.75pt 1.5pt; line-height: normal;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><font size="3"><font face="Calibri">The ViewModel inquestion (MyTestViewModel) has a constructor of:</p><div></div></font></font></span><font size="3" face="Times New Roman"></font><p style="margin: 0cm 1.4pt 0pt 37.4pt; line-height: normal; mso-margin-top-alt: auto;" ="Ms&#111;normal"><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN">&#091;ImportingConstructor</span><span style='color: black; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN">&#093;<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 1.4pt 10pt 37.4pt; line-height: normal; mso-margin-bottom-alt: auto;" ="Ms&#111;normal"><span style='color: blue; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN">public</span><span style='color: black; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN"> MyTestViewModel(</span><span style='color: rgb43, 145, 175; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN">IGlobalCache</span><span style='color: black; font-family: C&#111;nsolas; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-ansi-: EN; mso-fareast-: EN-AU;' lang="EN">oface){}<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 1.5pt 0.75pt; line-height: normal;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><font size="3"><font face="Calibri">And theBootstrapper is set to launch MyTestViewModel. However, when the applicationruns I get the error message "Could not locate any instances of contractTest.ViewModels.MyTestViewModel.". <o:p></o:p></font></font></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><o:p><font size="3" face="Calibri">&nbsp;</font></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><span style='color: black; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: Calibri; mso-ansi-: EN; mso-fareast-: EN-AU; mso-bidi-theme-font: minor-latin;' lang="EN"><font size="3"><font face="Calibri">I note that when I change theconstructor of the GlobalCache class from this:<o:p></o:p></font></font></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: green; font-family: C&#111;nsolas; font-size: 9.5pt;">// this does not work</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">&#091;<span style="color: rgb43, 145, 175;">ImportingConstructor</span>&#093;<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">public</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">GlobalCache(&#091;<span style="color: rgb43, 145, 175;">Import</span>(RequiredCreationPolicy =<span style="color: rgb43, 145, 175;">CreationPolicy</span>.NonShared)&#093; <span style="color: rgb43, 145, 175;">IEntityManagerProvider</span>&lt;<span style="color: rgb43, 145, 175;">AdventureWorks2008R2Entities</span>&gt;entityManagerProvider)<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-indent: 36pt; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">_entityManagerProvider = entityManagerProvider;<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><o:p><font size="3" face="Calibri">&nbsp;</font></o:p></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><font size="3"><font face="Calibri">To this:<o:p></o:p></font></font></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">&#091;<span style="color: rgb43, 145, 175;">ImportingConstructor</span>&#093;<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="color: blue; font-family: C&#111;nsolas; font-size: 9.5pt;">public</span><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">GlobalCache()<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">{<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-indent: 36pt; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p>&nbsp;</o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt 36pt; line-height: normal; text-autospace: ; mso-layout-grid-align: n&#111;ne;" ="Ms&#111;normal"><span style="font-family: C&#111;nsolas; font-size: 9.5pt;">}<o:p></o:p></span></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><o:p><font size="3" face="Calibri">&nbsp;</font></o:p></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><font size="3" face="Calibri">Then the error goes away and the application runs, howeverthe </font><span style="line-height: 115%; font-family: C&#111;nsolas; font-size: 9.5pt;">entityManagerProvider</span><font size="3"><font face="Calibri"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">isobviously not set and hence the GlobalCache is of somewhat limited use.</span><span style="line-height: 115%; font-family: C&#111;nsolas; font-size: 9.5pt;"><o:p></o:p></span></font></font></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 10pt;" ="Ms&#111;normal"><font size="3"><font face="Calibri">Any ideas what I am not doing correctly?<o:p></o:p></font></font></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt;" ="Ms&#111;normal"><font size="3"><font face="Calibri">Thanks<o:p></o:p></font></font></p><font size="3" face="Times New Roman"></font><p style="margin: 0cm 0cm 0pt;" ="Ms&#111;normal"><font size="3"><font face="Calibri">Mark<o:p></o:p></font></font></p><font size="3" face="Times New Roman"></font>]]>
   </description>
   <pubDate>Mon, 03 Sep 2012 05:38:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3603&amp;PID=14304#14304</guid>
  </item> 
 </channel>
</rss>