<?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 : Two Entities and Two DataBase problem</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Two Entities and Two DataBase problem</description>
  <pubDate>Thu, 16 Apr 2026 22:39:31 -700</pubDate>
  <lastBuildDate>Thu, 03 Feb 2011 11:52:22 -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=2482</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>Two Entities and Two DataBase problem : Hi Molinari;Please see code example...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9866#9866</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 03-Feb-2011 at 11:52am<br /><br />Hi Molinari;<div><br></div><div>Please see code example below.</div><div><br></div><div><div>&#091;TestMethod&#093;</div><div>&nbsp;&nbsp; &nbsp;public void UsingDefaultManager() { &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;var mgr1 = new NorthwindIBEntityManager();</div><div>&nbsp;&nbsp; &nbsp; &nbsp;var mgr2 = new FantasyFootballEntityManager();</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp;var a = mgr1.Employees.FirstOrNullEntity();</div><div>&nbsp;&nbsp; &nbsp; &nbsp;var b = mgr2.Clubs.Take(9).ToList();</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp;var default1 = NorthwindIBEntityManager.DefaultManager;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;EntityManager.DefaultManager = mgr2;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;var default2 = FantasyFootballEntityManager.DefaultManager;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;var clubInCache = default2.FindEntities&lt;Club&gt;(EntityState.AllButDetached).ToList();</div><div>&nbsp;&nbsp; &nbsp;}</div></div><div><br></div><div>The last query finds all entities of type Club in cache. The results are 9 clubs which is correct because the previous query</div><div><br></div><div>mgr2.Clubs.Take(9).ToList();</div><div><br></div><div>takes 9 Club entities and put them in cache.</div>]]>
   </description>
   <pubDate>Thu, 03 Feb 2011 11:52:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9866#9866</guid>
  </item> 
  <item>
   <title>Two Entities and Two DataBase problem : Hi Denisk,  Ok.. but I need using...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9865#9865</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=911" rel="nofollow">Molinari</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 03-Feb-2011 at 11:40am<br /><br />Hi Denisk,<br /><br />Ok.. but I need using two  database..and project has only one EntityManager so when i need to run the query EntitiesFirst()  I set in EntityManager after I need execute the query EntitiesSecond() then set new again... <br /><br />I create one Test .... every time change EntityManader.DefaultManager.... cache is Empty...<br /><br />if you can post the code...for example..I thank]]>
   </description>
   <pubDate>Thu, 03 Feb 2011 11:40:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9865#9865</guid>
  </item> 
  <item>
   <title>Two Entities and Two DataBase problem : Hi Molinari;No, you don&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9864#9864</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 03-Feb-2011 at 11:11am<br /><br />Hi Molinari;<div><br></div><div>No, you don't need to set it to new EntitiesSecond() every time. You can set it to any existing EntityManager of type EntitiesSecond and use its cache.</div>]]>
   </description>
   <pubDate>Thu, 03 Feb 2011 11:11:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9864#9864</guid>
  </item> 
  <item>
   <title>Two Entities and Two DataBase problem : Hi Denisk,  Then mean that I can...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9862#9862</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=911" rel="nofollow">Molinari</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 03-Feb-2011 at 4:28am<br /><br />Hi Denisk,<br /><br />Then mean that I can never use the cache on EntitiesSecond. because I need set&nbsp;&nbsp;&nbsp;NEW EntityManager.DefaultManager = new EntitiesSecond();<br /> every time  before executing a query ? Or has some way to use this cache?<br /><br />thanks..]]>
   </description>
   <pubDate>Thu, 03 Feb 2011 04:28:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9862#9862</guid>
  </item> 
  <item>
   <title>Two Entities and Two DataBase problem : Hi Mollinary;The DefaultManager...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9859#9859</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 02-Feb-2011 at 3:31pm<br /><br />Hi Mollinary;<div><br></div><div>The DefaultManager is a static shared property across all EntityManager(s). This means that the following are the same instance.</div><div><br></div><div>EntityManager.DefaultManager</div><div>EntitiesFirst.DefaultManager</div><div>EntitiesSecond.DefaultManager</div><div><br></div><div>Which means that before you get the DefaultManager and assign it to a different type, you need to set it to the proper type first as follows:</div><div><br></div><div>EntityManager.DefaultManager = new EntitiesSecond();</div><div>EntitiesSecond _em2 = EntitiesSecond.DefaultManager;</div><div><br></div><div>Hope this helps.</div>]]>
   </description>
   <pubDate>Wed, 02 Feb 2011 15:31:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9859#9859</guid>
  </item> 
  <item>
   <title>Two Entities and Two DataBase problem : I have two entities and two database......</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9858#9858</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=911" rel="nofollow">Molinari</a><br /><strong>Subject:</strong> 2482<br /><strong>Posted:</strong> 02-Feb-2011 at 7:38am<br /><br />I have two entities and two database...  Consequently.. two EM..<br /><br />EntitiesFirst _em = new EntitiesFirst();<br />_em.DefaultQueryStrategy = QueryStrategy.DataSourceOnly;<br /><br />EntitiesSecond _em2 = new EntitiesSecond();<br />_em2.DefaultQueryStrategy = QueryStrategy.Normal;<br /><br /><br /><br />When I use EntitiesFirst.. sucess but when i use EntitiesSecond..  <br /><br />public static void Test()<br />{<br />&nbsp;&nbsp;&nbsp;EntitiesSecond _em2 = EntitiesSecond.DefaultManager;<br /><br />  _em2.Employer.Where(c=&gt;c.id == 1)....<br />}<br /><br />Show Error...<br />Type conflict: the DefaultManager is currently of type EntitiesFirst<br /><br />how to use it properly.<br /><br />Thanks<br /><br /><br />]]>
   </description>
   <pubDate>Wed, 02 Feb 2011 07:38:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2482&amp;PID=9858#9858</guid>
  </item> 
 </channel>
</rss>