Skip to main content

Entity Framework (EF) Core

  • 2 minutes to read

The Items Source Configuration Wizard allows you to bind the PivotGridControl to an SQL database using the Entity Framework Core at design time. This topic guides you through the required steps.


In this tutorial, the PivotGridControl is bound to the Sales MS SQL database. Refer to the Getting started with EF Core on .NET Framework with an Existing Database topic for details on how to generate Entity Framework models for existing SQL databases.

  1. Click the PivotGridControl’s smart tag and select the Items Source Wizard command.


  2. In the invoked Items Source Configuration Wizard, select Entity Framework (EF) Core


    … and ensure the Data Sources area displays a context name.

  3. On the next page, select the binding method.


    • Simple Binding - allows you to bind the PivotGridControl to an EF Core data source directly.
    • Manipulating Data via ICollectionView - allows you to bind the PivotGridControl to an EF Core data source using the ICollectionView component, which enables collections to have the current record management functionalities, custom sorting, filtering, and grouping. See ICollectionView Specifics for more details.

    Select Simple Binding and click Next.

  4. On the final page, specify the table and click Finish.


  5. The PivotGridControl is now bound to the created data source.


    You can now use the Retrieve Fields command to retrieve the available data source fields. To retrieve fields in code, use the PivotGridControl.RetrieveFields method.


    Note that the Items Source Configuration Wizard adds the created data source to window resources.

            <dx:EntitySimpleDataSource x:Key="EntitySimpleDataSource" ContextType="{x:Type local:SalesContext}" Path="Orders">

    Then, it binds the PivotGridControl to the created data source.

    <dxpg:PivotGridControl DataSource="{Binding Data, Source={StaticResource EntitySimpleDataSource}}"/>