Skip to content

Latest commit

 

History

History
163 lines (136 loc) · 6.29 KB

File metadata and controls

163 lines (136 loc) · 6.29 KB

id: ODataStore module: common/data export: ODataStore inherits: Store


shortDescription

The ODataStore is a store that provides an interface for loading and editing data from an individual OData entity collection and handling related events.

lib

dx.web.js, dx.viz.js, dx.all.js



jQuery
<!--JavaScript-->
var store = new DevExpress.data.ODataStore({
    url: "http://www.example.com/Northwind.svc/Products",
    key: "ProductID",
    keyType: "Int32",
    // Other ODataStore properties go here
});

// ===== or inside the DataSource =====
var dataSource = new DevExpress.data.DataSource({
    store: {
        type: "odata",
        url: "http://www.example.com/Northwind.svc/Products",
        key: "ProductID",
        keyType: "Int32",
        // Other ODataStore properties go here
    },
    // Other DataSource properties go here
});
Angular
<!--TypeScript-->
import ODataStore from "devextreme/data/odata/store";
import DataSource from "devextreme/data/data_source";
// ...
export class AppComponent {
    store: ODataStore;
    dataSource: DataSource;
    constructor () {
        this.store = new ODataStore({
            url: "http://www.example.com/Northwind.svc/Products",
            key: "ProductID",
            keyType: "Int32",
            // Other ODataStore properties go here
        });

        // ===== or inside the DataSource =====
        this.dataSource = new DataSource({
            store: new ODataStore({
                url: "http://www.example.com/Northwind.svc/Products",
                key: "ProductID",
                keyType: "Int32",
                // Other ODataStore properties go here
            }),
            // Other DataSource properties go here
        });
    }
}
Vue
<!-- tab: App.vue -->
<script>
import ODataStore from 'devextreme/data/odata/store';
import DataSource from 'devextreme/data/data_source';

const store = new ODataStore({
    url: 'http://www.example.com/Northwind.svc/Products',
    key: 'ProductID',
    keyType: 'Int32',
    // Other ODataStore properties go here
});

// ===== or inside the DataSource =====
const dataSource = new DataSource({
    store: new ODataStore({
        url: 'http://www.example.com/Northwind.svc/Products',
        key: 'ProductID',
        keyType: 'Int32',
        // Other ODataStore properties go here
    }),
    // Other DataSource properties go here
});

export default {
    // ...
    data() {
        return {
            store,
            // ===== or =====
            dataSource
        }
    }
}
</script>
React
<!-- tab: App.js -->
// ...
import ODataStore from 'devextreme/data/odata/store';
import DataSource from 'devextreme/data/data_source';

const store = new ODataStore({
    url: 'http://www.example.com/Northwind.svc/Products',
    key: 'ProductID',
    keyType: 'Int32',
    // Other ODataStore properties go here
});

// ===== or inside the DataSource =====
const dataSource = new DataSource({
    store: new ODataStore({
        url: 'http://www.example.com/Northwind.svc/Products',
        key: 'ProductID',
        keyType: 'Int32',
        // Other ODataStore properties go here
    }),
    // Other DataSource properties go here
});

class App extends React.Component {
    // ...
}
export default App;
ASP.NET MVC Controls
<!--Razor C#-->@(Html.DevExtreme().WidgetName()
    .DataSource(ds => ds.OData()
        .Url("http://www.example.com/Northwind.svc/Products")
        .Key("ProductID")
        .KeyType(EdmType.Int32)
        // Other ODataStore properties go here
    )
)

To access an entire OData service, use the ODataContext instead.

#include datalayer-store-note-immutable with { name: "ODataStore" }

A 1-Click Solution for CRUD Web API Services with Role-based Access Control via EF Core

If you target .NET for your backend API, be sure to check out Web API Service and register your free copy today. The Template Kit scaffolds an OData v4 Web API Service (.NET 8+) with integrated authorization & CRUD operations powered by EF Core ORM. You can use OAuth2, JWT or custom authentication strategies alongside tools like Postman or Swagger (OpenAPI) for API testing. The built-in Web API Service also filters out secured server data based on permissions granted to users. Advanced/enterprise functions include audit trail, endpoints to download reports, file attachments, check validation, obtain localized captions, etc.

To use the free Template Kit (which creates the Web API Service), run the Universal Component Installer from the DevExpress Download Manager and use our predefined template in Visual Studio 2022+ or JetBrains Rider.

Read Tutorial | View Examples: JavaScript (DevExtreme) & JavaScript (Svelte) | Watch Videos

#####See Also#####