Binding to a Data Source Using Entity Framework
- 2 minutes to read
The PivotGridControl automatically operates in server mode if it is bound to appropriate supported data source. This example demonstrates how to generate model and mapping information, and bind the pivot grid to the data source using the Entity Framework.
Creating Data Classes
Add ADO.NET Entity Data Model to the project.
Create a model in the EF Designer based on an existing database. You can choose the database connection, settings for the model, and database objects to include in the model. The classes your application will interact with are generated from the model.
You can specify the model by dragging database tables and views from Server Explorer to the model.
Save your changes and rebuild the solution.
Binding a Pivot Grid Control to the EntityServerModeSource component
Drag the EntityServerModeSource component and drop it onto the Form.
Specify the queryable source with the EntityServerModeSource.QueryableSource property. This property must be set in code.
Bind the Pivot Grid control to the EntityServerModeSource component.
To learn how to bind the PivotGridControl to data using the Data Source Configuration Wizard, see the Entity Framework Data tutorial.