[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-Time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Collapse]Examples
    [Collapse]Providing Data
      How to: Create the Fields and Bind the PivotGridControl to a Data Source
      How to: Bind a Pivot Grid to an OLAP Data Source
      How to: Bind a PivotGridControl to an OLAP Cube Using the OLE DB Data Provider
      How to: Bind a PivotGridControl to an OLAP Cube Using the ADOMD.NET Data Provider
      How to: Bind a PivotGridControl to an OLAP Cube via XMLA
      How to: Add an Unbound Field to Supply Additional Data
      How to: Add an Unbound Field to Change Axis Detailing
      How to: Provide Data for an Unbound Field Using Expressions
      How to: Save PivotGridControl Data to a File and Work with It Later
      How to: Bind a PivotGridControl to a Database at Design Time so that it Operates in Server Mode
      Server Mode with LINQ to SQL
      Server Mode with Entity Framework
    [Expand]Summarization
    [Expand]Sorting
    [Expand]Grouping
    [Expand]Filtering
    [Expand]Drill-Down (Underlying Data)
    [Expand]Editing
    [Expand]Layout Features
    [Expand]Formatting
    [Expand]Data Output
    [Expand]Appearance
    [Expand]Serialization
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Server Mode with Entity Framework

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.

Expanded 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:

    When you click Finish at the last Entity Data Model Wizard screen, the following warning appears:

    The created model looks as follows:

Important

After you create a data model, rebuild the solution.

Expanded Binding PivotGridControl to the EntityServerModeSource component

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

    Note

    Alternatively, you can create the EntityServerModeSource (see EntityServerModeSource) in code at runtime.

  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.

    The resulting code looks as follows:

  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..

Expanded See Also

Is this topic helpful?​​​​​​​