Provides access to the entire OData service.

Included in: dx.mobile.js, dx.web.js, dx.viz.js, dx.viz-web.js, dx.all.js
Export: default


The ODataContext object creates several ODataStore instances inside. Each of these instances accesses a separate entity. To create an ODataContext instance, pass the configuration object to the ODataContext constructor. Specify the service URL and the list of entities you need to access.

var context = new DevExpress.data.ODataContext({
    url: "http://www.example.com/Northwind.svc",
    entities: {
        Categories: {
            key: "CategoryID",
            keyType: "Int32"
        MyCustomers: {
            name: "Customers",
            key: "CustomerID",
            keyType: "String"

If you need to specify a composite key for an entity, assign an array of key expressions to the key option. In this case, the keyType option takes on an object providing corresponding properties for each key expression, as demonstrated in the following example.

var context = new DevExpress.data.ODataContext({
    url: "http://www.example.com/Northwind.svc",
    entities: {
        Products: {
            key: [ "ProductID", "ProductCode" ],
            keyType: {
                ProductID: "Guid",
                ProductCode: "Int32" 

The ODataContext object also includes the get() and invoke() methods used to invoke service operations, and the objectLink() helper method to link entities.

For more information on working with OData, refer to the Data Source Examples article.


This section describes configuration options used to configure the ODataContext.

Name Description

Specifies a function used to customize a web request before it is sent.


Specifies whether stores in the ODataContext serialize/parse date-time values.


Specifies the list of entities to be accessed with the ODataContext.


Specifies the function called if the ODataContext causes an error.


Specifies whether to use JSONP to access CORS-incompatiable remote services.


Specifies the URL of the data service being accessed via the current ODataContext.


Specifies the version of the OData protocol used to interact with the data service.


Specifies the value of the withCredentials field of the underlying jqXHR object.


This section describes the methods used to manipulate the ODataContext.

Name Description
get(operationName, params)

Invokes a WebGet service operation that returns a value.

invoke(operationName, params, httpMethod)

Invokes a WebGet service operation that returns nothing.

objectLink(entityAlias, key)

Gets a special proxy object to describe the entity link.