2
votes

I am keeping local entities in breeze cache, how can i delete them from the cache with out going to the server? in the documentation it states

Deleting an entity You delete an entity by changing its EntityState to “Deleted” like this:

1 someEntity.entityAspect.setDeleted(); // mark for deletion setDeleted does not destroy the object locally nor does it remove the entity from the database. The entity simply remains in cache in its new “Deleted” state … as changed and added entities do. A successful save does delete the entity from the database and remove it from cache.

2

2 Answers

4
votes

You can do this by detaching the entity from entity manager by calling manager's detachEntity method :

manager.detachEntity(entity);

The detached entity will eventually be garbage collected.

Refer to Breeze-Inside Entity

0
votes

You can do entity.setDeleted(); and then call saveChanges method. if you want to save it in DB. if not want to go to server manager.detachEntity(nameofYourEntity);