EntityServerModeDataSource Class
A data source that can be associated with the Entity Framework source.
Namespace: DevExpress.Data.Linq
Assembly: DevExpress.Web.v18.2.dll
Declaration
Remarks
The EntityServerModeDataSource component allows you to bind the ASPxCardView, ASPxGridView, ASPxVerticalGrid, ASPxComboBox and ASPxPivotGrid controls to a data source via the Entity Framework, and enable the database server mode. To do this, follow the steps listed below:
- use the EntityServerModeDataSource.ContextTypeName property to specify the type of objects retrieved from a data source;
- use the EntityServerModeDataSource.TableName property to specify the table name;
- bind the ASPxGridView to the EntityServerModeDataSource component.
Important
To use the Server Mode with Entity Framework 6+, it is necessary to use special options on the application startup. To learn more, see the Knowledge Base Article: Is it possible to use the Entity Framework 6 and Server Mode together.
Online Demos
WebForms:
- ASPxGridView - Large Database (Server Mode)
- ASPxCardView - Large Database (Server Mode)
- ASPxVerticalGrid - Large Database (Server Mode)
MVC:
- GridView - Large Database (Server Mode)
- CardView - Large Database (Server Mode)
- VerticalGrid - Large Database (Server Mode)
Example
The following example illustrates how to use the EntityServerModeDataSource
component.
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" KeyFieldName="ID"
Width="100%" AutoGenerateColumns="False" OnCustomColumnDisplayText="grid_CustomColumnDisplayText"
OnSummaryDisplayText="grid_SummaryDisplayText">
<Columns>
<dx:GridViewDataTextColumn FieldName="From" Width="200px" />
<dx:GridViewDataTextColumn FieldName="Subject" />
<dx:GridViewDataDateColumn FieldName="Sent" Width="100px" />
<dx:GridViewDataCheckColumn Caption="Attachment?" FieldName="HasAttachment" Width="100px" />
<dx:GridViewDataTextColumn FieldName="Size" Width="80px">
<Settings AllowAutoFilter="false" />
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
<dx:EntityServerModeDataSource ID="EntityServerModeDataSource" runat="server"
ContextTypeName="DevExpress.Web.Demos.LargeDatabaseContext" TableName="Emails" />