Share via


ODataPreferenceHeader Class

Definition

Class to set the "Prefer" header on an IODataRequestMessage or the "Preference-Applied" header on an IODataResponseMessage.

public class ODataPreferenceHeader
type ODataPreferenceHeader = class
Public Class ODataPreferenceHeader
Inheritance
ODataPreferenceHeader

Properties

AnnotationFilter

Property to get and set the "odata.include-annotations" preference with the given filter to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. If the "odata-annotations" preference is already on the header, set replaces the existing instance. Returning null indicates that the "odata.include-annotations" preference is not on the header.

The filter string may be a comma delimited list of any of the following supported patterns: "" -- Matches all annotation names. "ns." -- Matches all annotation names under the namespace "ns". "ns.name" -- Matches only the annotation name "ns.name". "-" -- The exclude operator may be used with any of the supported pattern, for example: "-ns." -- Excludes all annotation names under the namespace "ns". "-ns.name" -- Excludes only the annotation name "ns.name". Null or empty filter is equivalent to "-".

The relative priority of the pattern is base on the relative specificity of the patterns being compared. If pattern1 is under the namespace pattern2, pattern1 is more specific than pattern2 because pattern1 matches a subset of what pattern2 matches. We give higher priority to the pattern that is more specific. For example: "ns." has higher priority than "" "ns.name" has higher priority than "ns." "ns1.name" has same priority as "ns2."

Patterns with the exclude operator takes higher precedence than the same pattern without. For example: "-ns.name" has higher priority than "ns.name".

Examples: "ns1.,ns.name" -- Matches any annotation name under the "ns1" namespace and the "ns.name" annotation. ",-ns.*,ns.name" -- Matches any annotation name outside of the "ns" namespace and only "ns.name" under the "ns" namespace.

ContinueOnError

Property to get and set the "odata.continue-on-error" preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting true sets the "odata.continue-on-error" preference. Setting false clears the "odata.continue-on-error" preference. Returns true of the "odata.continue-on-error" preference is on the header. Otherwise returns false if the "odata.continue-on-error" is not on the header.

MaxPageSize

Property to get and set the "odata.maxpagesize" preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting N sets the "odata.maxpagesize=N" preference. Setting null clears the "odata.maxpagesize" preference. Returns N if the "odata.maxpagesize=N" preference is on the header. Returning null indicates that "odata.maxpagesize" is not on the header.

RespondAsync

Property to get and set the "respond-async" preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting true sets the "respond-async" preference. Setting false clears the "respond-async" preference. Returns true if the "respond-async" preference is on the header. Otherwise returns false if the "respond-async" is not on the header.

ReturnContent

Property to get and set the "return=representation" and "return=minimal" preferences to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting true sets the "return=representation" preference and clears the "return=minimal" preference. Setting false sets the "return=minimal" preference and clears the "return=representation" preference. Setting null clears the "return=representation" and "return=minimal" preferences. Returns true if the "return=representation" preference is on the header. Otherwise returns false if the "return=minimal" is on the header. Returning null indicates that "return=representation" and "return=minimal" are not on the header.

TrackChanges

Property to get and set the "odata.track-changes" preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting true sets the "odata.track-changes" preference. Setting false clears the "odata.track-changes" preference. Returns true of the "odata.track-changes" preference is on the header. Otherwise returns false if the "odata.track-changes" is not on the header.

Wait

Property to get and set the "wait" preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage. Setting N sets the "wait=N" preference. Setting null clears the "wait" preference. Returns N if the "wait=N" preference is on the header. Returning null indicates that "wait" is not on the header.

Methods

Clear(String)

Clears the preference from the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage.

Get(String)

Gets the preferenceName from the "Prefer" header from the underlying IODataRequestMessage or the "Preference-Applied" header from the underlying IODataResponseMessage.

Set(HttpHeaderValueElement)

Sets the preference to the "Prefer" header on the underlying IODataRequestMessage or the "Preference-Applied" header on the underlying IODataResponseMessage.

Applies to