Skip to content

Simple.OData.Client fluent API

Andreas Presthammer edited this page Mar 3, 2014 · 9 revisions

Simple.OData.Client has two API sets that can be used to retrieve and modify OData resources: basic and fluent, the later one in fact combines three syntax flavors: untyped, typed and dynamic. Each of APIs provides full set of OData protocol operations, so choice of the API depends on client application design and personal developer's preferences. Fluent API consists of methods that can be chained to form parts of OData HTTP request. These methods are defined on a generic interface IFluentClient<T> that is accessed from an ODataClient instance by calling For(collectionName) or For<CollectionType>(). Each fluent method except for those sending OData command to server has return value of IFluentClient that can be used for further method chaining.

Here is a list of fluent commands defined in IFluentClient interface:

As - casts IFluentClient<T1> to IFluentClient<T2>, used when navigating between related entities
Key - used for lookup by unique resource key
Filter - sets the query condition
Skip - sets the number of entries to skip
Top - sets the number of entries to retrieve
Expand - used to expand related entities
Select - specifies which resource properties to retrieve
OrderBy - sets the entry retrieval order
ThenBy - appends to retrieval order
OrderByDescending - sets the descending entry retrieval order
ThenByDescending - appends to descending retrieval order
Count - requests the number of entries that satisfy the request condition
NavigateTo - navigates to a related entity
Set - assigns a value to en entry, used in inserts and updates

Refer to pages describing data retrieval and modification for examples of using Simple.OData.Client fluent API.


See also:
Simple.OData.Client basic API
Getting started with Simple.OData.Client