Including newly added (but not saved) entities in executeQueryLocallly results

StackOverflow https://stackoverflow.com/questions/22991062

  •  01-07-2023
  •  | 
  •  

Question

We have an EF / breeze setup, where the breeze client has a full set of metadata. When we create a new entity (using entityManager.CreateEntity()), subsequent calls to executeQueryLocally() for the default resource set don't include the newly created entity - until entityManager.saveChanges() is called.

e.g. (pseudocode):

var newEntity = entityManager.createEntity('Customer');
var query = breeze.entityQuery
              .from('Customers');
// Returns zero results
var result = entityManager.executeQueryLocally(query);

entityManager.saveChanges();
// Returns one result
var result = entityManager.executeQueryLocally(query);

Does anyone know of a way that we can persuade breeze to include the newly created entities in the query results for executeQueryLocally?

Was it helpful?

Solution

I reproduced your test and it works properly for me with Breeze 1.4.11. i.e. I get one result in each case.

Are you sure that you are calling entityManager.createEntity ( which works) vs entityType.createEntity ( which will not work until you add the returned entity to the entityManager)?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top