Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Net.Http.OData.Query

Trevor Pilley edited this page May 22, 2020 · 14 revisions

The Query Options describe an OData query which has been made against the OData service, the following classes and their public members are contained within the namespace Net.Http.OData.Query.

Query

FilterQueryOption

Contains deserialised values from the $filter query option.

Property Description
QueryNode Expression { get; } Gets the expression.

FormatQueryOption

Contains deserialised values from the $format query option.

Property Description
MediaTypeHeaderValue MediaTypeHeaderValue { get; } Gets the media type header value.

IODataQueryOptionsValidator

The interface for an ODataQueryOptions validator.

Method Description
void Validate(ODataQueryOptions queryOptions, ODataValidationSettings validationSettings) Validates the specified query options using the specified validation settings.

ODataQueryOptions

Contains the query options in an OData query.

Property Description
bool Count { get; } Gets a value indicating whether the count query option has been specified.
EntitySet EntitySet { get; } Gets the EntitySet to apply the OData query against.
SelectExpandQueryOption Expand { get; } Gets SelectExpandQueryOption which represents the $expand query option.
FilterQueryOption Filter { get; } Gets FilterQueryOption which represents the $filter query option.
FormatQueryOption Format { get; } Gets FormatQueryOption which represents the $format query option.
OrderByQueryOption OrderBy { get; } Gets OrderByQueryOption which represents the $orderby query option.
ODataRawQueryOptions RawValues { get; } Gets the raw values of the OData query request.
SearchQueryOption Search { get; } Gets SearchQueryOption which represents the $search query option.
SelectExpandQueryOption Select { get; } Gets SelectExpandQueryOption which represents the $select query option.
int? Skip { get; } Gets the integer value specified in the $skip query option.
SkipTokenQueryOption SkipToken { get; } Gets SkipTokenQueryOption which represents the $skiptoken query option.
int? Top { get; } Gets the integer value specified in the $top query option.

ODataQueryOptionsValidator

Method Description
static IODataQueryOptionsValidator GetValidator(ODataVersion odataVersion) Gets the IODataQueryOptionsValidator for the specified ODataVersion.

ODataRawQueryOptions

Contains the raw query options in an OData query.

Property Description
string Count { get; } Gets the raw $count query value from the incoming request Uri if specified.
string Expand { get; } Gets the raw $expand query value from the incoming request Uri if specified.
string Filter { get; } Gets the raw $filter query value from the incoming request Uri if specified.
string Format { get; } Gets the raw $format query value from the incoming request Uri if specified.
string OrderBy { get; } Gets the raw $orderby query value from the incoming request Uri if specified.
string Search { get; } Gets the raw $search query value from the incoming request Uri if specified.
string Select { get; } Gets the raw $select query value from the incoming request Uri if specified.
string Skip { get; } Gets the raw $skip query value from the incoming request Uri if specified.
string SkipToken { get; } Gets the raw $skiptoken query value from the incoming request Uri if specified.
string Top { get; } Gets the raw $top query value from the incoming request Uri if specified.

ODataValidationSettings

Defines the validation settings to use when validating values in ODataQueryOptions.

Property Description
static ODataValidationSettings All Gets the validation settings for when all OData queries are allowed.
static ODataValidationSettings None Gets the validation settings for when no OData queries are allowed.
AllowedArithmeticOperators AllowedArithmeticOperators { get; set; } Gets or sets the allowed arithmetic operators.
AllowedFunctions AllowedFunctions { get; set; } Gets or sets the allowed functions.
AllowedLogicalOperators AllowedLogicalOperators { get; set; } Gets or sets the allowed logical operators.
AllowedQueryOptions AllowedQueryOptions { get; set; } Gets or sets the allowed query options.
int MaxTop { get; set; } Gets or sets the max value allowed in the $top query option.

OrderByDirection

Property Description
Ascending The results are to be filtered by the named property in ascending order.
Descending The results are to be filtered by the named property in descending order.

OrderByProperty

Represents an order by property expression in the $orderby query option.

Property Description
OrderByDirection Direction { get; } Gets the direction the property should be ordered by.
PropertyPath PropertyPath { get; } Gets the property path to order by.
string RawValue { get; } Gets the raw request value.

OrderByQueryOption

Contains deserialised values from the $orderby query option.

Property Description
IReadOnlyList<OrderByProperty> Properties { get; } Gets the properties the query should be ordered by.

QueryOption

The base class for an OData System Query Option.

Property Description
string RawValue { get; } Gets the raw request value.

SearchQueryOption

Contains deserialised values from the $search query option.

SelectExpandQueryOption

Contains deserialised values from the $select or $expand query option.

Property Description
IReadOnlyList<PropertyPath> PropertyPaths { get; } Gets the property paths specified in the query.

SkipTokenQueryOption

Contains deserialised values from the $skiptoken query option.

Expressions

BinaryOperatorKind

The kinds of binary operator.

Property Description
Or
And
Equal
NotEqual
GreaterThan
GreaterThanOrEqual
LessThan
LessThanOrEqual
Add
Subtract
Multiply
Divide
Modulo
Has

BinaryOperatorNode

A QueryNode which represents a binary operator with a left and right branch.

Property Description
QueryNode Left { get; } Gets the left query node.
BinaryOperatorKind OperatorKind { get; } Gets the kind of the operator.
QueryNode Right { get; internal set; } Gets the right query node.

ConstantNode

A QueryNode which represents a constant value.

Property Description
EdmType EdmType { get; } Gets the EdmType of the value.
string LiteralText { get; } Gets the literal text if the constant value.
object Value { get; } Gets the constant value as an object.

FunctionCallNode

A QueryNode which represents a function call.

Property Description
string Name { get; } Gets the name of the function.
IReadOnlyList<QueryNode> Parameters { get; } Gets the parameters for the function call.

PropertyAccessNode

A QueryNode which represents a property.

Property Description
PropertyPath PropertyPath { get; } Gets the property path being referenced in the query.

PropertyPath

Represents a property path.

Property Description
PropertyPath Next { get; } Gets the next property in the path being referenced in the query, or null if this instance is the last (or only) property in the path.
EdmProperty Property { get; } Gets the EdmProperty representing the property being referenced in the query.

QueryNode

The base class for a query node.

Property Description
abstract QueryNodeKind Kind { get; } Gets the kind of query node.

QueryNodeKind

Property Description
BinaryOperator
PropertyAccess
Constant
FunctionCall
UnaryOperator

UnaryOperatorKind

Property Description
Not

UnaryOperatorNode

A QueryNode which represents a unary operator.

Property Description
QueryNode Operand { get; } Gets the operand of the unary operator.
UnaryOperatorKind OperatorKind { get; } Gets the kind of the operator.

Parsers

ParserSettings

Contains settings used by the parsers.

Property Description
static DateTimeStyles DateTimeStyles { get; set; } Gets or sets the DateTimeStyles to use for parsing DateTimeOffset if no timezone is specified in the OData query (defaults to AssumeUniversal).