Using Breeze.js coupled with an Asp.net Web Api (with Entity Framework 6 Code First) I am unabled to get entities after a call to executeQuery(query). More specifically here is my call in javascript:
entityManager.executeQuery(query)
.then(function(data){
alert(data.results.length); // length > 0 --> has data !!
alert(entityManager.getEntities().length); // == 0 has no data WHY?!!
});
while executeQuery(query) does hit my api controller on the server and returns data to client because data.results.length > 0, it looks like data is not not cached because entityManager.getEntities().length == 0. How then can I track changes if data is not cached? Am I missing something? After googling around I found this post http://forum.ideablade.com/forum_posts.asp?TID=3739&title=entity-manager-cache-not-working where it is said that Simply put, Breeze requires that the models and dbcontext be in the same namespace. Is this the issue in play here? since I cannot change my namespaces (dbcontext and api controllers come from an external library I do not have control hover) what workaround could be used in this case?
The most likely cause is that the objects returned by the server are not entity data ... at least not from the point of view of the Breeze client.
Perhaps you can show us your query.
Check out the "Query Result Debugging" topic in the Breeze documentation.