Breeze don't have a look of what's happened to data at server side when saving these data. Breeze team said you must re-query to have updated data. Actions done synchronously during this saving like sql triggers (expl. After Insert) may be considered because of these operations can transform entities during saving so they take place at client : this will be useful for new keys not generated by Breeze like multi-parts keys. I have difficult to work-around this problem. Help?
UPDATE 1: If this is the principle with Breeze it's probrably a bug.
1) The trigger (at server-side) is part of the entity (table)
2) Frameworks used :
- server-side framework : .NET Framework 4.5
- client framework : Breeze 1.3.5
- view framework : knockout 2.2.1
3) result scenario from saveChanges:
function saveTousRecos() {
return manager.saveChanges()
.then(success)
.fail(fail);
function success(saveResult) {
/* do your post-save work here */
axi = saveResult.entities[0].jobtab();
// axi is an identity key generated at server and sent back to client by Breeze
// result : Breeze value = (195), the same as server-side (195)
ara = saveResult.entities[0].seqtab();
// ara is a property value inserted by sql FOR INSERT trigger,
// result : Breeze value = (NULL), server-side has (13)
logger.log("Saving succeded... ");
}
function fail(error) {
logger.log("Saving failed: " + error.message);
}
}
P.S. : all values inserted by SQL triggers are not visible at all unless you re-call entity from server, not from cache; seems like a work-around not the solution I suppose.
UPDATE 2: I think that Breeze considers my return entities as OData like.
1) from my Breeze Api controlleur I use this :
return _contextProvider.Context.clients.Where(uc => uc.refclie == rqnoclie);
2) Breeze said : With OData, any change of the value of a server side computed field will not be available in Breeze after an update. If you need these values refreshed, you must requery...
3) so from now, the solution for me is REQUERY (not good news) to get my computed or triggered results. Hope the future of BeforeSaveEntity interceptors will solve this problem. Or how can I get pure entities for Breeze (not OData but computed or triggered server-side) ? Is there a way to get Out from this trouble?