<?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 : Entity manager cache not working</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Entity manager cache not working</description>
  <pubDate>Fri, 10 Apr 2026 19:27:34 -700</pubDate>
  <lastBuildDate>Wed, 07 Nov 2012 20:22:28 -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=3739</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>Entity manager cache not working :   Perhaps you are wondering(a)...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15146#15146</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 8:22pm<br /><br />Perhaps you are wondering&nbsp;<div><br><div><b>(a) Why did the query return results but no entities in cache?&nbsp;</b></div><div><b><br></b></div><div><b>(b) Why did Breeze allow the model type and DbContext namespaces to be mismatched? Why didn't it protest?</b><div><b><br></b></div><div>Let me assure you that Breeze behaved exactly as intended ... if not in the way you expected.</div><div><br></div><div>In this example, the client query was routed to the Web API controller's "Items" method. The server responded with JSON data for a type 'Item" belonging to the namespace 'Model'. &nbsp;Breeze on the client doesn't know about an '<b>Item</b>' type in the namespace '<i><b>Model</b></i>'; it knows about an '<b>Item</b>' type in the namespace '<i><b>Data</b></i>'. But that's not the same type at all. Breeze simply doesn't know what type of data it received. Therefore, it cannot turn that data into 'Item' entities ... which is why there are no Items in cache.</div></div></div><div><br></div><div>But the server did return data and Breeze dutifully provides those data as JavaScript objects in the 'data.results' array of the query promise. In the post which started this thread, we know the server returned 45 'somethings'. They weren't entities - Breeze didn't know what they were. But you, the developer, asked for them and here they are.</div><div><br></div><div>Breeze does not demand that a query return entities. If the service returns data that it recognizes as entities - if the data are identified in metadata as entity types &nbsp;- Breeze will turn those data into entities and will put them in cache. Otherwise it forwards them to the caller via the promise.</div><div><br></div><div>There is nothing wrong with the server sending arbitrary data to the client. That's actually a useful feature. &nbsp;For example, suppose you have a Person entity and Person has 100 columns/properties including an image property that could be 100KB. We want to present a list of Persons, just their first and last names. We can't afford to download every property of every Person in the list.&nbsp;</div><div><br></div><div>Well, in Breeze we can make a "projection query" - a query for selected properties - and transmit only the properties we need. Clearly the data objects that satisfy our query are not whole Person entities. They are something else, something unnamed and un-typed. But something useful nonetheless.</div><div><br></div><div>Breeze doesn't judge. It doesn't insist that the query return whole Person entities. It simply examines the incoming data. If they are Persons, they become entities in cache. If not, fine, pass them along to the caller.</div><div><br></div><div>Therefore, Breeze shouldn't protest when it receives a data object of an unrecognized type. It was prepared to recognize 'Data.Item' data; it received 'Model.Item" data; no big deal ... and no entities in cache either.</div><div><br></div><div>---</div><div><br></div><div>This isn't the entire story. Actually, Breeze examines the incoming data objects looking for entities. If the incoming data are object graphs, &nbsp;Breeze traverses the graphs, looking for objects which it recognizes as entities. If it finds entities within the object graphs, it puts them in cache.</div><div><br></div><div>This is a super valuable feature. I use it to query and cache all of my pick-lists in a single shot. For example, I might create a service method called "Lookups" that returns a single object whose properties are arrays of Color, Status, Size, ProductType, ... you get the idea. That object is essentially a bag of lists that I'll use to populate comboboxes.</div><div><br></div><div>Then I make a single query to "Lookups" ... which returns this bag of lists.&nbsp;Now breeze doesn't recognize the bag at all. But each of the bag's properties is a a collection of objects that <b><i>are </i></b>described in metadata: Color is an entity type, Status is a type, Size is a type, ProductType is a type. Breeze recognizes that these nested objects are entities and puts them in cache.&nbsp;</div><div><br></div><div>So in a single request, in a single payload, I'm able to populate the EntityManager cache with all of the little pick-lists.</div><div><br></div><div>That's pretty cool.</div><span style="font-size:10px"><br /><br />Edited by WardBell - 07-Nov-2012 at 8:29pm</span>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 20:22:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15146#15146</guid>
  </item> 
  <item>
   <title>Entity manager cache not working :  Just so we&amp;#039;re clear: classes...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15141#15141</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 5:59pm<br /><br />Just so we're clear: <b>classes in different projects can share the same namespace</b>. This happens all the time; many Microsoft classes in different assemblies share the same namespace.<div><br></div><div><span style=": rgb251, 251, 253; "><b><i>You may not want to do that</i></b> but you certainly can.&nbsp;</span></div><div><span style=": rgb251, 251, 253; "><br></span></div><div><span style=": rgb251, 251, 253; ">If you don't want to do that, <b>the&nbsp;</b></span><a href="http://www.breezejs.com/&#100;ocumentati&#111;n/entity-framework-dbc&#111;ntext-0" target="_blank"><b>Entity Framework DbContext</b></a><span style=": rgb251, 251, 253; "><b>&nbsp;documentation shows a simple workaround</b>: create a <b>subclass of the DbContext that is in the model's namespace</b>. The DbContext subclass doesn't have to do anything other than inherit from your base DbContext ... and shift the namespace. This, I think, is a small price to pay to trick the metadata generation tooling.</span></div><div><span style=": rgb251, 251, 253; "><br></span></div><div><span style=": rgb251, 251, 253; ">I agree with separating the projects as you have done. That can be wise as models grow. Breeze will not interfere with that separation. You just need to spit on it a little bit to get the namespaces aligned.</span></div><div><span style=": rgb251, 251, 253; "><br></span></div><div><span style=": rgb251, 251, 253; "><b><font color="#3300ff">-- The above is in reply to CCPony who wrote the following ... which somehow has disappeared (maybe I deleted by accident?) --</font></b></span></div><div><p ="Ms&#111;normal">Placing the data components and the model files intoseparate projects and referencing those projects in the main web project causesthe error. <br><br>For example, if you have the following three projects: <br><br>BreezeTest.Model - contains item.cs <br><br>BreezeTest.Data - contains BreezeTestDatabaseInitializer.cs andBreezeTestDbContext.cs. This projects references BreezeTest.Model <br><br>BreezeTest.Web references both BreezeTest.Model and BreezeTest.Data <br><br>When you run BreezeTest.Web in this configuration you get: "3 items inquery" and "0 entities in cache". <br><br><br>As per Ward's attached sample, however, when all the files in the one project,you get "3 items in query" and "3 entities in cache". <br><br>So, the problem seems to be limited when using separate projects. By the way, Iused the RequireJs attachment. <br><br>Let me know if you have any other questions.&nbsp;<o:p></o:p></p></div><span style="font-size:10px"><br /><br />Edited by WardBell - 07-Nov-2012 at 6:08pm</span>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 17:59:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15141#15141</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Sorry for the oversight... I previously...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15140#15140</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1549" rel="nofollow">svk</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 5:52pm<br /><br />Sorry for the oversight... I previously read through all of the documentation and I must have overlooked this. &nbsp;It probably wasn't relevant at the time I read it. &nbsp;This is not a show stopper for me so I am happy to move on. &nbsp; &nbsp;thanks again.]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 17:52:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15140#15140</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : I did some testing just came to...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15139#15139</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1576" rel="nofollow">CCPony</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 5:44pm<br /><br />I did some testing just came to the same conclusion.  Thanks for handling so quickly.<span style="font-size:10px"><br /><br />Edited by CCPony - 07-Nov-2012 at 6:04pm</span>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 17:44:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15139#15139</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Yes, that is a known and documented...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15134#15134</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 3:13pm<br /><br />Yes, that is a known and documented requirement. The Model classes and the DbContext(s) must be in the same namespace; &nbsp;the controller can be in a different namespace.&nbsp;<div><br></div><div>We won't be trying to "fix" this any time soon. The Entity Framework tooling we use to generate the metadata only supports a single shared namespace and we don't think building our own metadata generation is a good investment at this time.</div><div><br></div><div>This issue ... and a workaround ... are discussed in our documentation on using the <a href="http://www.breezejs.com/&#100;ocumentati&#111;n/entity-framework-dbc&#111;ntext-0" target="_blank">Entity Framework DbContext</a> in a Breeze application.</div><div><br></div><div>After you've looked at that, if you still feel this is a critical shortcoming, please let us know and explain why.</div>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 15:13:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15134#15134</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Thanks for the sample projects,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15133#15133</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1549" rel="nofollow">svk</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 2:56pm<br /><br />Thanks for the sample projects, Ward. &nbsp;I was able to identify the problem. &nbsp;Simply put, Breeze requires that the models and dbcontext be in the same namespace.&nbsp;<div><br></div><div>You can repro the described&nbsp;behavior&nbsp;in your projects by moving BreezeTestDbContext &amp;&nbsp;BreezeTestDatabaseInitializer into a different namespace.&nbsp;</div><div><br></div><div>Is this something that can easily be fixed? &nbsp;Thanks!</div>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 14:56:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15133#15133</guid>
  </item> 
  <item>
   <title>Entity manager cache not working :  Now that I know how to attach...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15132#15132</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 2:10pm<br /><br />Now that I know how to attach a file, I present you with these same zip files attached to the forum post itself.<div><br></div><div>Version without require:&nbsp;<a href="uploads/482/CacheNotWorkingForum3739.zip" target="_blank">uploads/482/CacheNotWorkingForum3739.zip</a><br></div><div>Version with require:&nbsp;<a href="uploads/482/CacheNotWorkingForumWithRequire3739.zip" target="_blank">uploads/482/CacheNotWorkingForumWithRequire3739.zip</a></div><div><br></div><div>If you can reproduce the problem using either of these solutions and want us to evaluate it, you can upload your solution as I did here..</div><div><br></div><div><a href="http://www.ideablade.com/forum/forum_posts.asp?TID=3774&amp;title=attach-a-file-to-your-post" target="_blank">This forum topic explains how to attach and manage files</a></div>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 14:10:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15132#15132</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : I&amp;#039;m old around here and I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15125#15125</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 12:29pm<br /><br />I'm old around here and I don't see them either. Some problem with the forum attachment mechanism.&nbsp;<div><br></div><div>For now, you can get them at</div><div><a href="http://www.breezejs.com/sites/all/packages/CacheNotWorkingForum3739.zip" target="_blank">http://www.breezejs.com/sites/all/packages/CacheNotWorkingForum3739.zip</a>&nbsp;</div><div><a href="http://www.breezejs.com/sites/all/packages/CacheNotWorkingForumWithRequire3739.zip" target="_blank">http://www.breezejs.com/sites/all/packages/CacheNotWorkingForumWithRequire3739.zip</a></div><div><br></div><div>Until we get forum attachment straightened out, you'll have to tell us where to get the repro solutions that you create.</div>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 12:29:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15125#15125</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : I&amp;#039;m new around here.  Ward,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15124#15124</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1576" rel="nofollow">CCPony</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 12:21pm<br /><br />I'm new around here.  Ward, I don't see your attachments.  Where are they?  Thanks.]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 12:21:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15124#15124</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Ok everyone ... I cannot reproduce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15122#15122</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 12:02pm<br /><br />Ok everyone ... I cannot reproduce your issues. But I can give you two solutions, one with Require and one without, that follow the path prescribed by svk. I've attached both.<div><br></div><div>If you want to press this issue productively, I suggest that you use either of these solutions as a baseline for your reproduction of the error.</div>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 12:02:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15122#15122</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : I have a test bed that matches...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15119#15119</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 11:28am<br /><br />I have a test bed that matches SVK's sample ... except it doesn't yet use RequireJS. It works fine. Will now create a second version that uses Require. Maybe that is introducing a problem ... although we use Require all over the place.]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 11:28:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15119#15119</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Hang in there. We&amp;#039;ll take...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15118#15118</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 9:57am<br /><br />Hang in there. We'll take SVK's sample and try to repro. With luck everything we need will be there ... or at least we'll have a shared solution to kick around.]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 09:57:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15118#15118</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : I&amp;#039;m currently experiencing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15116#15116</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1576" rel="nofollow">CCPony</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 07-Nov-2012 at 9:35am<br /><br />I'm currently experiencing this exact same problem.<span style="font-size:10px"><br /><br />Edited by CCPony - 07-Nov-2012 at 9:37am</span>]]>
   </description>
   <pubDate>Wed, 07 Nov 2012 09:35:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15116#15116</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Looking at it now.   </title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15105#15105</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 06-Nov-2012 at 10:36am<br /><br />Looking at it now.]]>
   </description>
   <pubDate>Tue, 06 Nov 2012 10:36:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15105#15105</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Any thoughts? Am I doing something...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15103#15103</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1549" rel="nofollow">svk</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 06-Nov-2012 at 8:57am<br /><br />Any thoughts? &nbsp;Am I doing something incorrectly or might I be running up against a bug? &nbsp;Thanks.]]>
   </description>
   <pubDate>Tue, 06 Nov 2012 08:57:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15103#15103</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Using a very simple test application,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15075#15075</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1549" rel="nofollow">svk</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 04-Nov-2012 at 8:04am<br /><br />Using a very simple test application, I am experiencing the same problem - &nbsp;manager.getEntities().length always returns 0 while&nbsp;data.results.length returns the actual number of entities. &nbsp;Below are the components of the test app. &nbsp;Please let me know if I can provide any more information or if you have any ideas. &nbsp;Thanks!<div><br></div><div><b>Index.chtml looks like this:</b></div><div><div><div><font face="Courier New, Courier, mono">&lt;!DOCTYPE html&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;html&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;head&gt;</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &lt;title&gt;Breeze Test&lt;/title&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;/head&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;body&gt;</font></div><div><font face="Courier New, Courier, mono">Test</font></div><div><span style="font-family: 'Courier New', Courier, mono; ">&lt;script src="/Scripts/jquery-1.8.2.js"&gt;&lt;/script&gt;</span></div><div><font face="Courier New, Courier, mono">&lt;script src="/Scripts/knockout-2.2.0.debug.js"&gt;&lt;/script&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;script src="/Scripts/q.js"&gt;&lt;/script&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;script src="/Scripts/breeze.debug.js"&gt;&lt;/script&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;script src="/Scripts/require.js"&gt;&lt;/script&gt;</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&lt;script src="/Scripts/app/main.js"&gt;&lt;/script&gt;</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&lt;/body&gt;</font></div><div><font face="Courier New, Courier, mono">&lt;/html&gt;</font></div></div><div><br></div><div><b><i>Note: knockout is loaded but not used. &nbsp;The results are the same even when the test is expanded and a ko array is populated. &nbsp;The array is filled with entities but manager.getEntities() returns 0 so executeQueryLocally doesn't work. &nbsp;</i></b></div><div><br></div><div><br></div><div><b>main.js boots the app and looks like this:</b></div></div><div><span style="font-family: 'Courier New', Courier, mono; ">(function () {</span></div><div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; configRequire();</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; boot();</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; function configRequire() {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; requirejs.config({</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; paths: {'breeze': 'Scripts/breeze.debug'}</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; });</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; function boot() {</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; require(&#091;'breeze'&#093;, function (breeze) {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var core = breeze.core,</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; entityModel = breeze.entityModel;</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; core.config.setProperties({</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; trackingImplementation: entityModel.entityTracking_ko,</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; remoteAccessImplementation: entityModel.remoteAccess_webApi</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var serviceName = 'api/breezetest';</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var manager = new entityModel.EntityManager(serviceName);</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var query = new entityModel.EntityQuery().from("Items");</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; manager.executeQuery(query)</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .then(</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function (data) {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert("Got " + data.results.length + " data rows");</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert("Got " + manager.getEntities().length + " entities");</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; });</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono">})();</font></div></div><div><br></div><div><b>controller:</b></div><div><div><font face="Courier New, Courier, mono">namespace BreezeTest.Controllers</font></div><div><font face="Courier New, Courier, mono">{</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; public class BreezeTestController : ApiController</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; readonly EFContextProvider&lt;BreezeTestDbContext&gt; _contextProvider = new EFContextProvider&lt;BreezeTestDbContext&gt;();</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &#091;AcceptVerbs("GET"), ActionName("Metadata")&#093;</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; public string Metadata()</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _contextProvider.Metadata();</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &#091;AcceptVerbs("GET"), ActionName("Items")&#093;</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; public IQueryable&lt;Item&gt; Items()</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _contextProvider.Context.Items;</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono">}</font></div></div><div><br></div><div><b>metadata:</b></div><div><span style="font-family: 'Courier New', Courier, mono; font-size: 13px; line-height: normal; ">{"conceptualModels":{"schema":{"namespace":"BreezeTest.Data","alias":"Self","d4p1:UseStrongSpatialTypes":"false","xmlns:d4p1":"http://schemas.microsoft.com/ado/2009/02/edm/annotation","xmlns":"http://schemas.microsoft.com/ado/2009/11/edm","entityType":{"name":"Item","key":{"propertyRef":{"name":"Id"}},"property":&#091;{"name":"Id","type":"Edm.Int32","nullable":"false","d4p1:StoreGeneratedPattern":"Identity"},{"name":"Name","type":"Edm.String","fixedLength":"false","maxLength":"Max","unicode":"true","nullable":"true"},{"name":"Description","type":"Edm.String","fixedLength":"false","maxLength":"Max","unicode":"true","nullable":"true"}&#093;},"entityContainer":{"name":"BreezeTestDbContext","entitySet":{"name":"Items","entityType":"Self.Item"}}}}}</span></div><div><span style="font-family: 'Courier New', Courier, mono; font-size: 13px; line-height: normal; "><br></span></div><div><b>model:</b></div><div><div><font face="Courier New, Courier, mono">namespace BreezeTest.Models</font></div><div><font face="Courier New, Courier, mono">{</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; public class Item</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; {</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; public int Id { get; set; }</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; public string Name { get; set; }</font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; &nbsp; &nbsp; public string Description { get; set; }</font></div><div><font face="Courier New, Courier, mono"><br></font></div><div><font face="Courier New, Courier, mono">&nbsp; &nbsp; }</font></div><div><font face="Courier New, Courier, mono">}</font></div></div><div><font face="Courier New, Courier, mono"><br></font></div><div><b>dbcontext:</b></div><div><span style="font-size: 13px; line-height: normal; "><font face="Courier New, Courier, mono"><div>namespace BreezeTest.Data</div><div>{</div><div>&nbsp; &nbsp; public class BreezeTestDbContext : DbContext</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public DbSet&lt;Item&gt; Items { get; set; }</div><div>&nbsp; &nbsp; }</div><div>}</div></font></span></div>]]>
   </description>
   <pubDate>Sun, 04 Nov 2012 08:04:53 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=15075#15075</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : As a side note - if you are building...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14969#14969</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1525" rel="nofollow">pawel</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 25-Oct-2012 at 6:53am<br /><br /><div>As a side note - if you are building a solution based on CodeCamper with Breeze, then remember to remove json camelCasing formatting. Remove the following lines from&nbsp;Alcance.Web.GlobalConfig.CustomizeConfig()</div><div><div><span ="Apple-tab-span" style="white-space:pre">	</span>var json = config.Formatters.JsonFormatter;</div><div><span ="Apple-tab-span" style="white-space: pre; ">	</span>json.SerializerSettings.ContractResolver =</div><div><span ="Apple-tab-span" style="white-space: pre; ">	</span><span ="Apple-tab-span" style="white-space: pre; ">	</span>new CamelCasePropertyNamesContractResolver();</div></div><div><br></div><div>If you leave this configuration Breeze will be unable to populate your objects with data.</div>]]>
   </description>
   <pubDate>Thu, 25 Oct 2012 06:53:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14969#14969</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Ok, I was unable to reproduce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14960#14960</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 24-Oct-2012 at 1:14pm<br /><br />Ok, I was unable to reproduce the first part of your error (shown below). I do not have a copy of the "CodeCamper" database but I've run the same test with our test db ( a version of Northwind) and manager.getEntities returns an array that it the same length as data.results.length.&nbsp; So I'm not sure what's going on there.<br><br>&nbsp;var query = entityModel.EntityQuery.from("Categories");<br>&nbsp;manager.executeQuery(query).then(function (data) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(data.results.length);&nbsp; //this returns 45 results<br><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(manager.getEntities().length); // this returns 0 results. WHY????</b><br>&nbsp;});<br><br>As for "executeQueryLocally", it can only execute if the entityManager cache already has data in it.&nbsp; I cannot tell from your example, but is it possible that you are calling getByParentUrl before any call to getData has completed.&nbsp;&nbsp; Your getData method is asynchronous whereas your getByParentUrl is not, so you need to make sure that your getData call completes before calling getParentUrl. <br><br>If you continue to have issues, can you post a copy of your server side controller? <br><br><br>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 13:14:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14960#14960</guid>
  </item> 
  <item>
   <title>Entity manager cache not working : Hi there,I&amp;#039;ve been developing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14951#14951</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1565" rel="nofollow">mgkoko</a><br /><strong>Subject:</strong> 3739<br /><strong>Posted:</strong> 24-Oct-2012 at 3:23am<br /><br />Hi there,<br><br>I've been developing a SPA based on John Papa's example of code camper. I came across with breeze.js and I really want to use this rather than building my own client db context. So far it is OK, but like in code camper example I want to load some data from dataprimer and que the results as needed from local cache. but everytime I tried executeQueryLocally I got 'entityType is null' error. When I check getEntities() to see if I got the results in cached it returns blank but if I check data.results then there are results. my code is<br><br>define('dataservice.categories',<br>&nbsp;&nbsp;&nbsp; &#091;'jquery', 'underscore', 'ko', 'config', 'utils','breeze', 'store'&#093;,<br>&nbsp;&nbsp;&nbsp; function ($, _, ko, config, utils, breeze, store) {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var entityModel = breeze.entityModel,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; core = breeze.core;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // configure Breeze for Knockout and Web API <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; core.config.setProperties({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trackingImplementation: entityModel.entityTracking_ko,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; remoteAccessImplementation: entityModel.remoteAccess_webApi<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // service name is route to the Web API controller<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var serviceName = '/api/breeze';<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // manager is the service gateway and cache holder<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var manager = new entityModel.EntityManager(serviceName);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var getData = function () {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var query = entityModel.EntityQuery.from("Categories");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.executeQuery(query).then(function (data) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(data.results.length);&nbsp; //this returns 45 results<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(manager.getEntities().length); // this returns 0 results. WHY????<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getByParentUrl = function (url, results) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var query = entityModel.EntityQuery.from("Categories");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; query = query.where("Parent.FriendlyUrl", "==", null);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; manager.executeQueryLocally(query); //I think this is the line where I got 'entityType is null' error<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getData: getData,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getByParentUrl: getByParentUrl<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; });<br><br>Please let me know if you have any question<br>Thank you,<br>]]>
   </description>
   <pubDate>Wed, 24 Oct 2012 03:23:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3739&amp;PID=14951#14951</guid>
  </item> 
 </channel>
</rss>