Skip to main content
A newer version of this page is available. .

WCF Data Services

  • 2 minutes to read

The Data Source Configuration Wizard allows you to bind the PivotGridControl to data using WCF Data Services. This topic guides you through the steps needed to do this.

  1. Click the Data Source Wizard button placed on the PivotGridControl or use a corresponding command in a control’s smart tag.

    WinPivot_DataSourceButton

  2. In the invoked Data Source Configuration Wizard, select WCF Data Services

    DataSourceConfigurationWizard_SelectWCF

    … and click the New Data Source button placed within the Data Sources area.

    DataSourceConfigurationWizard_SelectAdoNet_NewDataSource

  3. The following message will appear.

    DataSourceConfigurationWizard_RebuildWarning

    Click OK.

  4. Specify the address of a data service.

    Pivot_AddWCFService

    To learn how to create a WCF data service, see the following topics: Creating the Data Service.

    Important

    After you creat a service reference, rebuild the solution.

  5. After creating a service reference, click the Data Source Wizard again.

    WinPivot_DataSourceButton

  6. In the invoked Data Source Configuration Wizard, select the created service.

    DataSourceConfigurationWizard_WCF_SelectService

    Click Next.

  7. On the next page, select the required binding method.

    DataSourceConfigurationWizard_EF_SelectBindingMethod

    Select Direct Binding to Data Source and click Next.

  8. On the final page, specify the service URI (Service Root) and click the Test Connection button.

    DataSourceConfigurationWizard_WCF_Finish

    Then, select the required Table and click Finish.

  9. The following code will be generated by the Data Source Configuration Wizard.

    
    public Form1()
            {
                InitializeComponent();
                // This line of code is generated by the Data Source Configuration Wizard
                pivotGridControl1.DataSource = new WinFormsPivot.ServiceReference1.NorthwindEntities(new System.Uri("http://localhost:65455/Northwind.svc/")).SalesPersons.ToList();
            }
    

    You can now work with the created data source at runtime. For instance, to retrieve fields from the connected data source, call the PivotGridControl.RetrieveFields method.