Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

javascript - breezejs: calling savecChanges for a classic ODATA service fails

I'm trying to save an Entity that was loaded using a classic WEBAPI ODATA service.

When saveChanges is called on the client side, the modified entity is found and then the code goes into ′createChangeRequests′ and because the entityState is modified it goes into the function :

 function updateDeleteMergeRequest(request, aspect, prefix) {
    var extraMetadata = aspect.extraMetadata;
    var uri = extraMetadata.uri;
    if (__stringStartsWith(uri, prefix)) {
        uri = uri.substring(prefix.length);
    }
    request.requestUri = uri;
    if (extraMetadata.etag) {
        request.headers["If-Match"] = extraMetadata.etag;
    }
}

However it raises an exception on the second line because extraMetadata is null. Where is this supposed to come from ? The property extraMetadata does not even exist on 'aspect'....

breeze does have metadata of my model since I can load entities. It's just that I cannot save.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

line 13318(breeze.debug.js):

    function mergeEntity(node, mappingContext, meta) {
      node._$meta = meta;
      meta.extra = node.__metadata;//added
      var em = mappingContext.entityManager;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...