Freigeben über


DataServiceContext.BeginSaveChanges Method (AsyncCallback, Object)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Asynchronously submits the pending changes to the data service collected by the DataServiceContext since the last time changes were saved.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

Syntax

'Declaration
Public Function BeginSaveChanges ( _
    callback As AsyncCallback, _
    state As Object _
) As IAsyncResult
public IAsyncResult BeginSaveChanges(
    AsyncCallback callback,
    Object state
)

Parameters

  • state
    Type: System.Object
    The user-defined state object used to pass context data to the callback method.

Return Value

Type: System.IAsyncResult
An IAsyncResult that represents the status of the asynchronous operation.

Remarks

Changes are added to the DataServiceContext by calling the AddObject, AddLink, AttachTo, AttachLink, DeleteObject, DeleteLink, Detach, or DetachLink methods.

Changes are sent to the data service as one change operation per HTTP request.

If an error occurs while processing an operation, no further operations are processed by the data service. Instead, a response is generated telling the client what operations were executed, the results, and which operations were not tried because of an error.

You must use the BeginInvoke method of the Dispatcher class to correctly marshal the response operation back to the main application thread (the UI thread) of your Silverlight-based application. For more information, see Synchronizing Data for Multithreading.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.