Table of Contents

Class ODataQueryCompilation

Namespace
Utils.OData.Linq
Assembly
Utils.OData.dll

Represents the result of compiling a LINQ expression tree into an OData query.

public sealed class ODataQueryCompilation
Inheritance
ODataQueryCompilation
Inherited Members
Extension Methods

Remarks

Item 36: this compilation model deliberately captures only $filter (from Where) and $expand (from navigation-property expansion). It intentionally does not model ordering, projection, $skip, $top, $count, $search, aggregation, or terminal operators. Those options must be applied through IQuery/ ODataQueryBuilder when issuing the request, or with LINQ-to-Objects after the data has been materialised. The public promise is narrowed to filter/expand compilation rather than advertising broader LINQ support that the model cannot honour.

Constructors

ODataQueryCompilation(string, IReadOnlyList<string>, IReadOnlyList<string>?)

Initializes a new instance of the ODataQueryCompilation class.

public ODataQueryCompilation(string entitySetName, IReadOnlyList<string> filters, IReadOnlyList<string>? expansions = null)

Parameters

entitySetName string

The name of the entity set targeted by the query.

filters IReadOnlyList<string>

The set of filter expressions applied to the query.

expansions IReadOnlyList<string>

The collection of navigation properties expanded by the query.

Exceptions

ArgumentException

Thrown when entitySetName is null or whitespace.

ArgumentNullException

Thrown when filters is null.

Properties

EntitySetName

Gets the name of the entity set targeted by the query.

public string EntitySetName { get; }

Property Value

string

Expansions

Gets the collection of navigation properties expanded by the query.

public IReadOnlyList<string> Expansions { get; }

Property Value

IReadOnlyList<string>

Filters

Gets the sequence of filter expressions applied to the query.

public IReadOnlyList<string> Filters { get; }

Property Value

IReadOnlyList<string>

Methods

ToUriString()

Builds the URI fragment that corresponds to the compiled query.

public string ToUriString()

Returns

string

The entity set name with appended OData query options when required.

Remarks

Item 26: query option values are percent-encoded so that characters such as spaces, ampersands, plus signs, and hash marks cannot corrupt the query-string boundary. The entity set name is used as a path segment and is not encoded here; callers that append this string to a base URI must ensure the overall URL is well-formed.