Sys.Data.AdoNetServiceProxy.remove Method

Deletes data through the data service.

remove: function(item, succeededCallback, failedCallback, userContext, webRequest)

Usage

exampleDataService.remove(item, succeededCallback, failedCallback, userContext, webRequest);

Parameters

Parameter

Definition

item

A JavaScript object that contains a __metadata property that specifies the resource URI of the data item to remove.

succeededCallback

(Optional) The function to execute when the remove operation succeeds.

failedCallback

(Optional) The function to execute when the remove operation fails.

userContext

(Optional) The state object for this operation.

webRequest

(Optional) The Sys.Net.WebRequest object to use for the Web request instead of the default Web request object.

Return Value

The Sys.Net.WebRequest object that performed the operation.

Remarks

Use the remove method to delete data through a data service. The remove method immediately executes a single remove operation. If you must execute more than one operation as a single batch, use the createActionSequence method.

To delete data, you pass the data to delete as a JavaScript object in the item parameter. To construct an object for the item parameter that matches the values in the data repository, you can retrieve the original object from a query.

The signatures for the callback functions must match the following examples:

function callbackSucceeded(result, context, operation)

function callbackFailed(error, context, operation)

The functions that you assign to the callback functions must accept three parameters. For the succeeded callback function, the first parameter always contains null. For the failed callback function, the first parameter contains the error that is returned by the data service. The second parameter contains the state object for the data operation. The third parameter contains a description of the operation that was performed. For remove operations, the third parameter contains "remove".

If you do not provide a value for the webRequest parameter, the AdoNetServiceProxy class creates a new instance of the Sys.Net.WebRequest class.

See Also

Other Resources

Sys.Data.AdoNetServiceProxy Class