Breeze - not return changes introduced in BeforeSaveEntities to client? -


i struggling find solution conceptual problem re beforesaveentities.

in short, want avoid server informing client entity deletions introduce in savemap in beforesaveentities.

the longer story follows below :-)

data structure: have entity called primarydata, has parallel loosely coupled entities called secondarydata. each primarydata, there exists number of secondarydata's.

business logic: whenever user deletes primarydata on client, server should delete related secondarydata.

security requirement: client should not informed secondarydata's have been deleted.

implementation: have implemented beforesaveentities function, catch deletion of primarydata, , add additional entityinfo's secondarydata's want delete savemap.

things work expected. both primarydata , secondarydata's deleted.

problem: unfortunately, xhr shows return package client includes secondarydata's have been deleted. violates security requirement above, client should not told deletion of secondarydata. client not need know secondarydata in part of application, there no functional need information transferred. going reload cache anyway.

question: possible instruct breeze not return deleted secondarydata's? e.g. setting in entityinfo can add savemap?

br morten

there no built-in way breeze this. can remove offending entities saveresult before send client. don't know server-side technology using, here's how might in .net webapi:

[httppost] public saveresult savechanges(jobject savebundle) {     saveresult sr = _context.savechanges(savebundle);     // remove entities of type secondarydata     sr.entities = sr.entities.where(e => e.gettype() != typeof(secondarydata)).tolist();     return sr; } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -