<?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 : GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated</description>
  <pubDate>Fri, 10 Apr 2026 19:11:20 -700</pubDate>
  <lastBuildDate>Tue, 02 Apr 2013 16:03:26 -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=4091</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>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : I chose the third option.Thank...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16157#16157</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 4:03pm<br /><br />I chose the third option.<div><br></div><div>Thank you again.</div>]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 16:03:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16157#16157</guid>
  </item> 
  <item>
   <title>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : You have a few options to safely...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16156#16156</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> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 3:08pm<br /><br />You have a few options to safely configure the EntityManagers once they are created.&nbsp;<div><br></div><div>1. You can subclass the EntityManagerProvider and override the CreateEntityManager method.&nbsp;</div><div><br></div><div>2. You can handle the static EntityManager.EntityManagerCreated event.</div><div><br></div><div>3. Or you can do it in the EntityManagerProvider.ManagerCreated event just like how the repository is populating the cache.&nbsp;</div>]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 15:08:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16156#16156</guid>
  </item> 
  <item>
   <title>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : Marcel, you are completely right!I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16155#16155</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 2:30pm<br /><br />Marcel, you are completely right!<div><br></div><div>I found my mistake. This line in the constructor of&nbsp;<span style="line-height: 1.4;">UnitOfWorkBase</span><span style="line-height: 1.4;">&nbsp;</span><span style="line-height: 1.4;">was the problem:</span></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial initial; -repeat: initial initial;">entityManagerProvider.Manager.VerifierEngine.PropertyNameToDisplayNameTranslator&nbsp;+=&nbsp;PropertyNameToDisplayNameTranslator;</pre></div><div>I was accessing the Manager before install the OnManagerCreated handler. I removed this line and now everything is perfect.</div><div><br></div><div>Thank you!!!</div><div><br></div><div>Now, I'll find a better place to translate the property names.</div><div><br></div>]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 14:30:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16155#16155</guid>
  </item> 
  <item>
   <title>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : Also, the TempHire Harness is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16153#16153</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> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 1:49pm<br /><br />Also, the TempHire Harness is not using the global cache. The Harness uses a single shared EntityManager instead. You will see that the GlobalCache class is not part of the Harness project, so it's not being found at runtime and in addition the Harness bootstrapper registers the EntityManagerProvider as a singleton.]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 13:49:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16153#16153</guid>
  </item> 
  <item>
   <title>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : That means the EntityManager has...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16152#16152</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> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 1:43pm<br /><br />That means the EntityManager has already been created at the time you install the OnManagerCreated handler. The EntityManager gets created the first time the Manager property of the EntityManagerProvider is accessed. Your application must be accessing the Manager property before you get a chance to install the handler.&nbsp;<div><br></div><div>Make sure that each UnitOfWork actually gets a new instance of the EntityManagerProvider injected and that its Manager property is not accessed before each of the repositories is fully instantiated.&nbsp;</div><div><br></div><div>To ensure that you get a new instance make sure you have attributed the entityManagerProvider parameter with the NonShared creation policy as it is done in TempHire.</div><div><br></div><div><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font-family: C&#111;nsolas, 'Liberati&#111;n Mono', Courier, monospace; color: rgb51, 51, 51;"><div ="line" id="LC25" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">        &#091;ImportingConstructor&#093;</span></div><div ="line" id="LC26" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">public</span> <span ="nf" style="margin: 0px; padding: 0px; border: 0px; color: rgb153, 0, 0; font-weight: bold;">ResourceMgtUnitOfWork</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">(</span></div><div ="line" id="LC27" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">            <b>&#091;Import(RequiredCreationPolicy = CreationPolicy.NonShared)&#093;</b></span> <span ="n" style="margin: 0px; padding: 0px; border: 0px;">IEntityManagerProvider</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">&lt;</span><span ="n" style="margin: 0px; padding: 0px; border: 0px;">TempHireEntities</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">&gt;</span></div><div ="line" id="LC28" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span ="n" style="margin: 0px; padding: 0px; border: 0px;">entityManagerProvider</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">,</span></div><div ="line" id="LC29" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="na" style="margin: 0px; padding: 0px; border: 0px; color: rgb0, 128, 128;">            &#091;Import(AllowDefault = true)&#093;</span> <span ="n" style="margin: 0px; padding: 0px; border: 0px;">IGlobalCache</span> <span ="n" style="margin: 0px; padding: 0px; border: 0px;">globalCache</span> <span ="p" style="margin: 0px; padding: 0px; border: 0px;">=</span> <span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">null</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">)</span></div><div ="line" id="LC30" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span ="p" style="margin: 0px; padding: 0px; border: 0px;">:</span> <span ="k" style="margin: 0px; padding: 0px; border: 0px; font-weight: bold;">base</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">(</span><span ="n" style="margin: 0px; padding: 0px; border: 0px;">entityManagerProvider</span><span ="p" style="margin: 0px; padding: 0px; border: 0px;">)</span></div><div ="line" id="LC31" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span ="p" style="margin: 0px; padding: 0px; border: 0px;">{</span></div><div ="line" id="LC31" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span ="p" style="margin: 0px; padding: 0px; border: 0px;"><span ="Apple-tab-span" style="white-space:pre">	</span>   ...</span></div><div ="line" id="LC32" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"><span style="line-height: 1.4;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span ="p" style="line-height: 1.4; margin: 0px; padding: 0px; border: 0px;">}</span></div></pre></div>]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 13:43:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16152#16152</guid>
  </item> 
  <item>
   <title>GlobalCache - EntityManagerProvider doesn&#039;t fire ManagerCreated : Hi guys,I&amp;#039;ve written a structure...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16151#16151</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1485" rel="nofollow">cefernan</a><br /><strong>Subject:</strong> 4091<br /><strong>Posted:</strong> 02-Apr-2013 at 12:55pm<br /><br />Hi guys,<div><br></div><div>I've written a structure of global cache exactly like TempHire does.&nbsp;</div><div><br></div><div>So, i<span style="line-height: 1.4;">n the constructor of my GlobalCacheRepository:</span></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial initial; -repeat: initial initial;">entityManagerProvider.ManagerCreated&nbsp;+=&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">EventHandler</span>&lt;<span style="color:#2b91af;">EntityManagerCreatedEventArgs</span>&gt;(OnManagerCreated)&nbsp;&nbsp;&nbsp;&nbsp;.MakeWeak(eh&nbsp;=&gt;&nbsp;entityManagerProvider.ManagerCreated&nbsp;-=&nbsp;eh);</pre></div><div>And:</div><div><pre><span style="font-family: C&#111;nsolas; font-size: 13px;"><span style="color:blue;">internal</span>&nbsp;<span style="color:blue;">void</span>&nbsp;OnManagerCreated(<span style="color:blue;">object</span>&nbsp;sender,&nbsp;<span style="color:#2b91af;">EntityManagerCreatedEventArgs</span>&nbsp;e){&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">if</span>&nbsp;(_globalCache&nbsp;==&nbsp;<span style="color:blue;">null</span>)&nbsp;<span style="color:blue;">return</span>; &nbsp;&nbsp;&nbsp;&nbsp;Seed(e.EntityManager); &nbsp;&nbsp;&nbsp;&nbsp;e.EntityManager.Cleared&nbsp;+=&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">EventHandler</span>&lt;<span style="color:#2b91af;">EntityManagerClearedEventArgs</span>&gt;(OnCleared)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.MakeWeak(eh&nbsp;=&gt;&nbsp;e.EntityManager.Cleared&nbsp;-=&nbsp;eh);}<span style="color:blue;">internal</span>&nbsp;<span style="color:blue;">void</span>&nbsp;OnCleared(<span style="color:blue;">object</span>&nbsp;sender,&nbsp;<span style="color:#2b91af;">EntityManagerClearedEventArgs</span>&nbsp;e){&nbsp;&nbsp;&nbsp;&nbsp;Seed(e.EntityManager);}<span style="color:blue;">private</span>&nbsp;<span style="color:blue;">void</span>&nbsp;Seed(<span style="color:#2b91af;">EntityManager</span>&nbsp;entityManager){&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;entities&nbsp;=&nbsp;_globalCache.Get&lt;T&gt;();&nbsp;&nbsp;&nbsp;&nbsp;entityManager.ImportEntities(entities,&nbsp;<span style="color:#2b91af;">MergeStrategy</span>.OverwriteChanges);}</span><font face="Verdana, Arial, Helvetica, sans-serif"><span style="white-space: normal;"></span></font></pre></div><div><div>But, when I run the app I realize that the method &nbsp;OnManagerCreated is never fired. Consequently, the ViewModel loads no results in my objects that read my global cache entities.</div><div><br></div><div>The method LoadAsync() in GlobalCache contains the cached entities that I need.</div><div><br></div><div>So, if I implement IDiscoverableViewModel in the same ViewModel and run the app through Harness, the global cache starts to work.</div><div><br></div><div>I think my mistake is something related to MEF.</div></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Tue, 02 Apr 2013 12:55:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4091&amp;PID=16151#16151</guid>
  </item> 
 </channel>
</rss>