corelibraries-devexpress-dot-data-dot-odatalinq.md
The data source for the GridControl and SearchLookUpEdit controls that binds these controls to OData service in Server Mode.
Namespace : DevExpress.Data.ODataLinq
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.ODataServerModeSource.bmp")]
public class ODataServerModeSource :
Component,
IListSource,
ISupportInitialize,
IODataServerModeFrontEndOwner,
IDXCloneable,
IXtraSourceError
<ToolboxBitmap(GetType(ResFinder), "Bitmaps256.ODataServerModeSource.bmp")>
Public Class ODataServerModeSource
Inherits Component
Implements IListSource,
ISupportInitialize,
IODataServerModeFrontEndOwner,
IDXCloneable,
IXtraSourceError
The ODataServerModeSource component implements the IListSource interface, and can be used as a data source for a control supporting the server mode.
Note
ODataServerModeSource is a read-only data source.
Server Mode allows a data-aware control to rapidly work with large datasets. Loading records in small portions on demand and performing data-aware operations on the data server side are the key features of server mode.
When the control needs to display a specific portion of data, it calls a specific method of the bound server mode data source. This method sends a corresponding request to the data store, and upon receiving the results, passes them back to the control.
Use ODataServerModeSource to bind a server-mode enabled control to the OData service using OData Client for .NET, as follows:
Specify the type of objects contained in the query result using the ODataServerModeSource.ElementType property.
Specify the required query request to an OData service via the ODataServerModeSource.Query property.
Bind the control to the ODataServerModeSource component.
public MainWindow() {
InitializeComponent();
grid.DataSource = new ODataServerModeSource() {
KeyExpression = "CustomerID",
Query = myDataServiceContext.Customers
};
}
Public Sub New()
InitializeComponent()
grid.DataSource = New ODataServerModeSource() With {
.KeyExpression = "CustomerID",
.Query = myDataServiceContext.Customers}
End Sub
Note
A BadRequestException that occurs when data is being sorted, counted, etc., may be caused by the breaking change in Web API OData V6.0.0. For details, refer to the Global Query Setting section in the OData Web API documentation.
If you target .NET for your backend API, be sure to check out our free Web API Service and register your FREE copy today. The Solution Wizard scaffolds an OData v4 Web API Service (.NET 6+) with integrated authorization & CRUD operations powered by EF Core and our XPO ORM library. You can use OAuth2, JWT or custom authentication strategies alongside tools like Postman or Swagger (OpenAPI) for API testing.
Among its numerous capabilities, our built-in Web API Service 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 Solution Wizard (which creates the Web API Service) run the Universal Component Installer from the DevExpress Download Manager.
Object MarshalByRefObject Component ODataServerModeSource
See Also