Data Binding to Large Data via EF
- 3 minutes to read
The Bootstrap Card View control supports binding to large data sets with the EntityServerModeDataSource component. This component fully supports the database server mode (i.e., it delegates all data processing to the DB server), and loads the minimum required amount of records to be displayed on the screen. This allows you to dramatically increase performance when working with large datasets.
Server mode can be enabled for any Entity Framework (EF) Data Model. The EntityServerModeDataSource component is designed for ASP.NET applications, and serves as the data source for the Bootstrap Card View control.
When an end-user performs data operations - sorting, filtering, etc., the EntityServerModeDataSource component analyzes the grid's current state and generates smart queries to receive only those records that must be displayed on-screen. These requests are passed to the associated EF Data Model. The EF Data Model translates them into the required queries and executes them.
The EntityServerModeDataSource component is a read-only data source, starting with the Entity Framework version 4.1 and above, because it provides DbContext, as opposed to ObjectContext that was in version 4.0 and older. Thus, using the Entity Framework version 4.1 and above, you cannot perform data editing, inserting and deleting via the built-in BootstrapCardView functionality.
To enable data modification operations, you need to handle the corresponding BootstrapCardView events manually (ASPxCardView.CardUpdating, ASPxCardView.CardInserting, and ASPxCardView.CardDeleting respectively). To learn how to handle these events, see the following KB article - How to implement common scenarios when using ASPxGridView bound with EntityDataSource / Entity Framework - Manual CRUD operations topic.
The EntityServerModeDataSource component allows you to bind the Bootstrap Card View to the ADO.NET Entity Data Model and enable database server mode.
Create Data Classes
Add the ADO.NET Entity Data Model.
- Follow the wizard's steps to generate a new data model using the code-first or database-first development approach.
- Save the generated model, close the EDMX diagram, and build the solution.
Connect to the Data Model using the EntityServerModeDataSource control
- Drag the EntityServerModeDataSource component and drop it onto the Page.
- Specify the data context type name using the EntityServerModeDataSource.ContextTypeName property.
- Specify the data table name using the EntityServerModeDataSource.TableName property.
- Bind the Card View control to the EntityServerModeDataSource component and specify its ASPxGridBase.KeyFieldName property.
Database Server Mode Limitations
In database server mode, the Bootstrap Card View does not have simultaneous access to bound data in its entirety. This imposes some limitations on the grid's features, which are still available in regular binding mode. Please see the following topic for information on features that are not supported in server mode: Database Server Mode Limitations.