Back to Devexpress

Server Mode with Entity Framework

windowsforms-115614-controls-and-libraries-pivot-grid-binding-to-data-server-mode-binding-to-server-mode-datasources-binding-to-a-data-source-using-entity-framework.md

latest2.2 KB
Original Source

Server Mode with Entity Framework

  • Oct 31, 2022
  • 3 minutes to read

The PivotGridControl automatically operates in server mode if it is bound to the Entity Framework data source. This example demonstrates how to generate model and mapping information, and bind the Pivot Grid control to the data source with the Entity Framework.

Creating Data Classes

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

  2. Create a model in the EF Designer based on an existing database. You can choose the model type, a database connection string, the objects to include in the model. The following image gallery shows the Entity Data Model Wizard:

Important

After you create a data model, rebuild the solution.

Binding PivotGridControl to the EntityServerModeSource component

  1. Drag the EntityServerModeSource component and drop it onto the Form.

  2. Specify the type of objects retrieved from a data source using the EntityServerModeSource.ElementType and EntityServerModeSource.KeyExpression properties.

  3. Specify the queryable source with the EntityServerModeSource.QueryableSource property.

  4. Bind the Pivot Grid control to the EntityServerModeSource component.

  5. Run the project. The PivotGridControl works in server mode. You can see the generated SQL statements in the Visual Studio Output window.

Note

The complete sample project PivotGridControl and Entity Framework - a Server Mode Example is available in the DevExpress Examples repository..

See Also

Server Mode with LINQ to SQL

Entity Framework Data