ODataQuery
using Skipcheck.Tm1.Client.OData;Used in the walkthroughs Connect and list your cubes, Read and write cells, Run a process and read its result, Test your code against a real TM1, Add TM1 to a Spring Boot application.
OData query options: $select, $expand (with nested options),
$filter, $orderby, $top, $skip, $count, custom
options such as TM1's !sandbox, and parameter aliases. Immutable: each method
returns a new query.
var query = ODataQuery
.None()
.Select("Name", "Type")
.Expand("Hierarchies", h => h.Select("Name").Top(5))
.Filter(Filter.StartsWith(ODataProperty.Of("Name"), "Q"))
.ToQueryString();
// $select=Name,Type&$expand=Hierarchies($select=Name;$top=5)&$filter=startswith(Name,'Q'), each value encoded
Options are written in a fixed order, lowercase with $ as OData 4.0 requires,
and each value is percent-encoded once by ToQueryString. Nested options
inside $expand are separated by ;.
Members
None static | No options. |
Select | Adds property paths to $select, after any already selected. |
Select | Adds properties to $select, after any already selected. |
Expand | Expands a navigation property with no nested options. |
Expand | Expands a navigation property, with nested options applied to what's there for it already. |
Expand | Expands a navigation property with no nested options. |
Expand | Expands a navigation property, with nested options. |
Filter | Sets $filter, replacing any set before. |
OrderBy | Adds an ascending $orderby key, after any keys already added. |
OrderByDescending | Adds a descending $orderby key, after any keys already added. |
OrderBy | Adds an ascending $orderby key. |
OrderByDescending | Adds a descending $orderby key, after any keys already added. |
Top | Sets $top. |
Skip | Sets $skip. |
WithCount | Sets $count=true. |
Option | A custom option, such as TM1's !sandbox. |
Option | The value of a custom option, or null. |
Alias | A parameter alias's value. |
IsEmpty | True if this query has no options. |
Parameters | Every option, unencoded, in order. |
ToQueryString | The encoded query string, without ?. |
ToString | The query string, before percent-encoding, for logs. |
Equals | |
Equals | |
GetHashCode |
None
staticODataQuery None()No options: the server's default response.
Select
ODataQuery Select(params string[] properties)Adds property paths to $select, after any already selected. Like every
option here it works the same at the top level and inside
Expand.
Select
ODataQuery Select(params ODataProperty[] properties)Adds properties to $select, after any already selected.
Expand
ODataQuery Expand(string navigation)Expands a navigation property with no nested options.
Expand
ODataQuery Expand(string navigation, Func<ODataQuery, ODataQuery> options)Expands a navigation property, with nested options applied to what's there for it already.
Expand
ODataQuery Expand(ODataProperty navigation)Expands a navigation property with no nested options:
Expand(Cube.Fields.Dimensions).
Expand
ODataQuery Expand(ODataProperty navigation, Func<ODataQuery, ODataQuery> options)Expands a navigation property, with nested options:
Expand(Dimension.Fields.Hierarchies, h =>
h.Select(Hierarchy.Fields.Name)).
Filter
ODataQuery Filter(Filter filter)Sets $filter, replacing any set before.
OrderBy
ODataQuery OrderBy(string property)Adds an ascending $orderby key, after any keys already added.
OrderByDescending
ODataQuery OrderByDescending(string property)Adds a descending $orderby key, after any keys already added.
OrderBy
ODataQuery OrderBy(ODataProperty property)Adds an ascending $orderby key:
OrderBy(Element.Fields.Name).
OrderByDescending
ODataQuery OrderByDescending(ODataProperty property)Adds a descending $orderby key, after any keys already added.
Top
ODataQuery Top(int n)Sets $top: at most this many items.
Throws
ArgumentExceptionnis negative.
Skip
ODataQuery Skip(int n)Sets $skip: skip this many items first.
Throws
ArgumentExceptionnis negative.
WithCount
ODataQuery WithCount()Sets $count=true: include the total number of matching items.
Option
ODataQuery Option(string name, string value)A custom option, such as TM1's !sandbox.
Option
string? Option(string name)The value of a custom option, or null.
Alias
ODataQuery Alias(ODataPath.Alias alias, string literalOrJson)A parameter alias's value: Fn(p=@p) with ?@p=….
IsEmpty
bool IsEmpty()True if this query has no options.
Parameters
IReadOnlyList<KeyValuePair<string, string>> Parameters()Every option, unencoded, in order.
ToQueryString
string ToQueryString()The encoded query string, without ?.
ToString
string ToString()The query string, before percent-encoding, for logs.
Equals
bool Equals(ODataQuery? other)Equals
bool Equals(object? obj)GetHashCode
int GetHashCode()