Binding to a Data Source Using 'LINQ to SQL Classes'
- 2 minutes to read
The PivotGridControl automatically operates in server mode if it is bound to appropriate supported data source. You can use dedicated data sources tailored to work with ‘LINQ to SQL Classes’. This example shows how to use LINQ query providers.
Creating Data Classes
Add LINQ to SQL Classes to the project.
Data classes can then be created and edited in an Object Relational Designer (O/R Designer). An O/R Designer provides a visual design surface for creating LINQ to SQL entity classes and relationships based on objects in a database. To learn more, see the MSDN topic.
You can create and map entity classes to tables and views by dragging database tables and views from Server Explorer onto the O/R Designer.
Save your changes, close the O/R Designer, and rebuild the solution.
Binding a Pivot Grid Control to the LinqServerModeSource component
Drag the LinqServerModeSource component and drop it onto the Form.
Specify the type of objects retrieved from a data source using the LinqServerModeSource.ElementType and LinqServerModeSource.KeyExpression properties.
Specify the queryable source using the LinqServerModeSource.QueryableSource property. This property must be set in code.
Bind the Pivot Grid control to the LinqServerModeSource component.
Note
To learn how to bind the PivotGridControl to data using the Data Source Configuration Wizard, see the LINQ to SQL tutorial.