DataServiceContext.AddAndUpdateResponsePreference Property

WCF Data Services 5.0

Gets or sets whether the client requests that the data service return entity data in the response message to a change request.

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

public DataServiceResponsePreference AddAndUpdateResponsePreference { get; set; }

Property Value

Type: System.Data.Services.Client.DataServiceResponsePreference
A DataServiceResponsePreference object that determines whether to request a response form the data service.

The AddAndUpdateResponsePreference property is used for HTTP POST, HTTP PUT, HTTP MERGE, and HTTP PATCH requests. This property setting determines whether the data service returns the inserted or updated entity in the body of the response message.

Setting the AddAndUpdateResponsePreference property to IncludeContent means that the Prefer header in the request is set to a value of return-content.

Setting the AddAndUpdateResponsePreference property to Default means that a Prefer header is not included in the request, and the client parses any entity included in the response message.

The client always parses the entry returned in the response message, even when the AddAndUpdateResponsePreference property to is set to a value of NoContent.

The Prefer header is supported in version 3 of the Open Data Protocol (OData) and later versions.