问题
how can you do put / post calls instead of using entityManager.saveChanges when using breeze js?
I basically have a readonly entity that is not being tracked but I need to call a service method that will take a parameter or two and will perform some action.
回答1:
It's a good question!
For now your best bet would be to bypass the Breeze.saveChanges method and simply use Breeze's ajax adapter directly. Something like this:
ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.ajax({
type: "POST",
url: "some.url",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
We do plan to provide a cleaner wrapper for this in one of the next few versions, but we are still trying to come up with the right design.
来源:https://stackoverflow.com/questions/18129539/how-to-make-put-post-calls-with-breeze-js