Error on saving changes using REST Endpoint using Silverlight End-point on BeginSaveChanges

Unanswered Error on saving changes using REST Endpoint using Silverlight End-point on BeginSaveChanges

  • 2012年4月11日 11:46
     
     

    Hi friends,

    in my code I am adding objects and deleting objects using

     _context.AddToNew_customentitySet(tempEntity)

    _context.DeleteObject(tempEntity);

    In the end to confirm changes I am trying to use

    _context.BeginSaveChanges(SaveChangesOptions.Batch, CallbackRefreshLists, _context);

    or

    _context.BeginSaveChanges(CallbackRefreshLists, _context);

    but the changes are not saved and I get an System.Data.Services.Client.DataServiceRequestExceptio

    with code 2147217150

    at System.Data.Services.Client.SaveResult < HandleBatchResponse > d__10.MoveNext()
    -End of inner exception stack trace-
    at System.Data.Services.Client.SaveResult.HandleBatchResponse()
    at System.Data.Services.Client.SaveResult.EndRequest()
    at System.Data.Services.Client.DataServiceContext.EndSaveChanges (IAsyncResult asyncResult)

    at myNamespace.MainPage < CallbackRefreshLists > d__3e.MoveNext()}

    Thanking you in advance,

    Sebastian

すべての返信

  • 2012年4月11日 15:06
    モデレータ
     
     

    Hi Sebastian,

    Could you try using a web-debugger like Fiddler (http://fiddlertool.com) to capture the raw request/response? You may find that the response from the server contains an error. Either way, it will help us diagnose the issue.

    Also, is there any other information provided in the exception, or just that code?


    Matt Meehan (WCF Data Services / OData)

  • 2012年4月11日 15:15
     
     
    Thanks very much Matt. I had installed it. I will try to use it.
  • 2012年4月13日 7:34
     
     

    Hi Matt,

    Yes I installed and played around with Fiddler ... thanks! but it seems (maybe I not really sure) this syntax _context.BeginSaveChanges(CallbackRefreshLists, _context)

    is not allowed for the CRM oData 2011 end point ... but the syntax I used which worked _context.BeginSaveChanges(CallbackRefreshLists, myobservablecollection)

    I have not idea how I could utilize the methods AddToNew_customentitySet(tempEntity) if _context.BeginSaveChanges(CallbackRefreshLists, _context) is not working (or maybe I am doing some mistakes).

    I am trying to move from On Premise CRM to IFD so maybe it will help me with accessing the OData endpoint becuase in the On premise deployment the entities are updated only when I access the my silverlight application from the local server where crm is installed.

    ys,

    Sebastian

  • 2012年4月13日 8:00
    モデレータ
     
     

    Hi,

    DataServiceContext.BeginSaveChanges takes two parameters, the first one is a callback (a delegate), the second one is custom state. There's nothing in the WCF DS code which tries to understand anything about the custom state. That object is just stored (the reference to it) and pass to your callback once the operation is done. So if the only difference between working code and broken code is what you pass to the custom state parameter, then it's likely that the problem lies in your callback (CallbackRefreshLists), since that's the only piece of code which would understand that custom state.

    If you're still getting the exception from above, please use Fiddler to capture the request and response which causes it and share it with us here. It should help us understanding the problem.

    Thanks,


    Vitek Karas [MSFT]