Example T828608
Visible to All Users

Pivot Grid for WinForms - a Server Mode Example (Entity Framework)

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.

screenshot

You can see the generated SQL statements in the Visual Studio Output window.

Files to Review

Form1.cs (Form1.vb)

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

EntityFrameworkServerModeExample/Form1.cs(vb)
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; } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.