1
votes

We are parsing the SaveBundle on the server and returning a custom SaveResult. We want to be able to notify the client of additional changed entities as a result of processing the SaveBundle.

For example we have a SaveBundle from the client containing 1 entity to be deleted which when we parse and process on the server we actually delete 2 entities.

As far as we can tell the SaveResult does not contain any properties that would allow us to indicate an entity was 'deleted', rather than say 'modified'.

Is there a way to return additional entity changes through the SaveResult? Or is the only solution to refresh the data by resubmitting a Breeze query client side after the save changes?

2

2 Answers

0
votes

I 'think' that if you return the deleted entities with their foreign keys set to null or empty (in the case of non-nullable guids etc.) in the SaveResult then Breeze client-side will detect this and mark them as deleted

I couldn't find anything explicitly in the documentation or the source about this though

0
votes

here is your answer:

var result = context.SaveChanges(saveBundle);

//create your own EntityInfo object and fill it with the the entity and it's state
var entityInfo = new EntityInfo();
//...

//add it to the result
result.Entities.Add(entityInfo);

//return the result
return result;

Breeze client will then treat that entity like any other entity returned from you normal save proc.

Hope this helps