Back to Devexpress

Binding to a Data Source Using Entity Framework

wpf-115625-controls-and-libraries-pivot-grid-binding-to-data-database-server-mode-binding-to-server-mode-datasources-binding-to-a-data-source-using-entity-framework.md

latest1.5 KB
Original Source

Binding to a Data Source Using Entity Framework

  • Aug 10, 2023

The PivotGridControl automatically operates in server mode if it is bound to appropriate supported data source. This example illustrates how to generate model and mapping information, and how to bind the pivot grid to a data source using the Entity Framework.

Creating Data Classes

  1. Add an ADO.NET Entity Data Model to the project.

  2. Follow the wizard steps to generate a new data model using the code-first or database-first development approach.

  3. Save the generated model, close the EDMX diagram, and rebuild the solution.

Binding the Pivot Grid control to the EntityServerModeDataSource component.

  1. Create a new instance of the EntityServerModeDataSource class. Specify the type of objects retrieved from a data source EntityServerModeDataSource.KeyExpression and EntityServerModeDataSource.QueryableSource properties. Finally, bind the Pivot Grid control to the EntityServerModeDataSource component.

See Also

Binding to a Data Source Using 'LINQ to SQL Classes'