This example demonstrates a Pivot Grid that is bound to the Entity Framework data source and operates in server mode.
Example Overview
The application contains two data sources bound to the Microsoft SQL database file:
Toggle the button to the Server Mode position to bind the Pivot Grid to the EntityServerModeSource
instance.
You can see the generated SQL statements in the Visual Studio Output window.
Files to Review
Documentation
More Examples
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using DevExpress.Data.Linq;
using DevExpress.XtraEditors;
using System;
namespace EntityFrameworkServerModeExample
{
public partial class Form1 : XtraForm
{
EntityServerModeSource entityServerModeSource;
bool serverMode = false;
public Form1()
{
InitializeComponent();
entityServerModeSource = new EntityServerModeSource
{
ElementType = typeof(EntityInvoice),
KeyExpression = "OrderId"
};
NWEntities context = new NWEntities();
context.Database.Log = Console.Write;
entityServerModeSource.QueryableSource = context.EntityInvoices;
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'nWDataSet.Invoices' table. You can move, or remove it, as needed.
this.invoicesTableAdapter.Fill(this.nWDataSet.Invoices);
SetPivotGridDataSource();
}
private void toggleSwitch1_Toggled(object sender, EventArgs e)
{
serverMode = ((ToggleSwitch)sender).IsOn;
SetPivotGridDataSource();
}
private void SetPivotGridDataSource()
{
if (serverMode)
pivotGridControl1.DataSource = entityServerModeSource;
else
pivotGridControl1.DataSource = invoicesBindingSource;
}
}
}