We have integrated breeze.js in our project and so far it has been great. But we are facing a problem. We are trying to load entities with executeQuery(). While the server returns data (results.length > 0) yet the call .entityManager.getEntities() returns an empty array.
Further information
- This is an Asp.net Web Api using Entity Framework 6 Code First and Breeze.ContextProvider.EF6
Our DbContext resides in the same assembly and namespace with the data Model. In fact we are using a custom DbContext BaseDataContext which derives from DbContext
namespace OurProject.Common.Base.Data{
public class BaseDataContext : DbContext{
... here go some basic virtual methods
}}
So for a specific entity say Product, we would have
namespace OurProject.Modules.Products.Data{
public class ProductsDataContext: BaseDataContext{
public virtual DbSet<Product> Products { get; set; }
.....
}
}
The reason I give these details is because the same issue has been mentionned in this forum http://ift.tt/18r59tG and some where down in the thread there is this post which says: "Simply put, Breeze requires that the models and dbcontext be in the same namespace"
Now here is the actual call on the client side
entityManager.executeQuery(query)
.then(function(data){
alert(data.results.length); // length > 0 --> has data !!
alert(entityManager.getEntities().length); // == 0 has no data WHY?!!
});
Is this issue caused by differences in namespace between our actual DbContext and our base DbContext? (for now it is not possible for us to change the namespaces) What workaround could we use to overcome this limitation?
Thank you very much for your insight.
Aucun commentaire:
Enregistrer un commentaire