How to call an arbitrary service for saving changes with breezejs?

女生的网名这么多〃 提交于 2020-01-17 08:29:13

问题


It sounds like the SaveChanges of BreezeJS is great for quick demos, but most real life applications need some sort of unit of work, business requirements, and/or sanity checks before actually saving to the data store. Is there a way to integrate BreezeJS with an ajax call that deals with inserting, deleting, and or updating the data rather than using SaveChanges?


回答1:


Breeze allows you to both change the server endpoint for 'SaveChanges' via the SaveOptions.resourceName property. (See the EntityManager.SaveChanges api for more info). You can also intercept the SaveChanges call on the server. ( See Save interception in the Breeze Documentation).

Moreover, there is no requirement that you use the current implementation of the Server side SaveChanges code. As long as you work with the SaveBundle that Breeze sends to the server and return a server side SaveResult, Breeze will work just fine. Admittedly, we don't yet have a great deal of documentation on this process, but the code is open-source and you can certainly see how its done right now.

In a related vein, we are working on an example of using Breeze against a MongoDb running under Node that uses completely different 'SaveBundle' and 'SaveResult' formats. We should be releasing this within the next few weeks.



来源:https://stackoverflow.com/questions/16797084/how-to-call-an-arbitrary-service-for-saving-changes-with-breezejs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!