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 the Server Explorer onto the O/R Designer.
Save your changes, close the O/R Designer, and rebuild the solution.
Binding the Pivot Grid control to the LinqServerModeDataSource component
Create a new instance of the LinqServerModeDataSource class. Specify the type of objects retrieved from a data source LinqServerModeDataSource.KeyExpression and LinqServerModeDataSource.QueryableSource properties. Finally, bind the Pivot Grid control to the LinqServerModeDataSource component.