<?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 : Not able to query locally cached data</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Not able to query locally cached data</description>
  <pubDate>Tue, 28 Apr 2026 16:37:44 -700</pubDate>
  <lastBuildDate>Fri, 17 Jul 2009 07:16:01 -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=1378</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>Not able to query locally cached data : Thanks Kim -- I had not yet executed...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4969#4969</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=241" rel="nofollow">AdamC</a><br /><strong>Subject:</strong> 1378<br /><strong>Posted:</strong> 17-Jul-2009 at 7:16am<br /><br />Thanks Kim -- I had not yet executed the query.&nbsp; Now I feel a little silly.&nbsp; :-)&nbsp; I had removed an earlier query and subsequent execution code but never added it back.&nbsp; I was seeing the cache file being created, but now I realize it doesn't mean actual data was saved.&nbsp; I think that's what hung me up.&nbsp; Looking at the cache file in a text editor with and without data shows a big difference.&nbsp; Thanks again. <br><br>For anyone interested in what I changed, please see the line in red:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>EntityQuery&lt;LOCAL_STRING&gt; localStringQuery = null;<br><br>localStringQuery =<br>&nbsp;&nbsp;&nbsp; (from ls in domainEntityManagerService.DomainEntityManager.LOCAL_STRING<br>&nbsp;&nbsp;&nbsp; select ls);<br><br><font color=RED>localStringQuery.Execute&lt;LOCAL_STRING&gt;();</font><br><br>domainEntityManagerService.DomainEntityManager.CacheStateManager.SaveCacheState("c:\localization.bin");<br></pre></td></tr></table><br>]]>
   </description>
   <pubDate>Fri, 17 Jul 2009 07:16:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4969#4969</guid>
  </item> 
  <item>
   <title>Not able to query locally cached data : My guess is that nothing was saved...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4965#4965</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 1378<br /><strong>Posted:</strong> 16-Jul-2009 at 7:00pm<br /><br />My guess is that nothing was saved to cache initially, or at least not what you expected.&nbsp; I'm confused by the block of code used to save cache state - you declare a query and then save cache, but the query has not yet been executed.&nbsp; ]]>
   </description>
   <pubDate>Thu, 16 Jul 2009 19:00:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4965#4965</guid>
  </item> 
  <item>
   <title>Not able to query locally cached data : Hi,I&amp;#039;m not able to retrieve...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4962#4962</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=241" rel="nofollow">AdamC</a><br /><strong>Subject:</strong> 1378<br /><strong>Posted:</strong> 16-Jul-2009 at 3:14pm<br /><br />Hi,<br><br>I'm not able to retrieve data I've cached locally.&nbsp; The second block of code (below) works fine when I am connected to the database.&nbsp; However, when I am notconnected to the database I get a "Sequence contains no elements"error.&nbsp; The stack trace is at the bottom.<br><br>Here is the code used to save the cache state (seems to work fine):<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EntityQuery&lt;LOCAL_STRING&gt; localStringQuery = null;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localStringQuery =<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (from ls in domainEntityManagerService.DomainEntityManager.LOCAL_STRING<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select ls);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainEntityManagerService.DomainEntityManager.CacheStateManager.SaveCacheState("c:\localization.bin");<br></pre></td></tr></table><br><br>Here is the code used to query the table/cache.&nbsp; The RestoreFromCache()method works fine -- it is the line in red throwing theexception.&nbsp; I may be going about this the wrong way, so hopefullysomeone can't point me in the right direction.&nbsp; Is it not possible to use LINQ queries against locally cached data?&nbsp; Thanks!<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private EntityQuery&lt;LOCAL_STRING&gt; localStringQuery = null;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public object GetValue(string localKey)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (domainEntityManagerService.DomainEntityManager.IsConnected == false &amp;&amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainEntityManagerService.DomainEntityManager.IsLoggedIn == false)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainEntityManagerService.DomainEntityManager.DefaultQueryStrategy = QueryStrategy.CacheOnly;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domainEntityManagerService.DomainEntityManager.CacheStateManager.RestoreCacheState("c:\localization.bin");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; localStringQuery =<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(from ls in domainEntityManagerService.DomainEntityManager.LOCAL_STRING<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where ls.LOCAL_KEY == localKey<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select ls);<br><br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <font color=RED>return localStringQuery.First().LOCAL_TEXT;</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch ( Exception ex )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></pre></td></tr></table><br><br><br>"&nbsp;&nbsp; at System.Linq.Enumerable.First&#091;TSource&#093;(IEnumerable`1source)\r\n&nbsp;&nbsp; at lambda_method(ExecutionScope )\r\n&nbsp;&nbsp; atSystem.Linq.EnumerableExecutor`1.Execute()\r\n&nbsp;&nbsp; atSystem.Linq.EnumerableExecutor`1.ExecuteBoxed()\r\n&nbsp;&nbsp; atSystem.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute(Expressionexpression)\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityQuery`1.ExecuteCacheQuery(GuidqueryGuid)\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityQueryFinder.ExecuteFind(GuidqueryGuid)\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityQueryFinder.Execute()\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityManager.ExecuteQueryCore(IEntityQueryquery, Boolean isAsync)\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityManager.ExecuteQueryForObject(IEntityQueryquery)\r\n&nbsp;&nbsp; atIdeaBlade.EntityModel.v4.EntityQuery`1.System.Linq.IQueryProvider.Execute&#091;TResult&#093;(Expressionexpression)\r\n&nbsp;&nbsp; at System.Linq.Queryable.First&#091;TSource&#093;(IQueryable`1source)\r\n&nbsp;&nbsp; atJenzabar.EX.Infrastructure.Localization.LocalizationProvider.GetValue(StringlocalKey) in C:\\Documents andSettings\\...\\LocalizationProvider.cs:line 79"<br>]]>
   </description>
   <pubDate>Thu, 16 Jul 2009 15:14:47 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1378&amp;PID=4962#4962</guid>
  </item> 
 </channel>
</rss>