<Window x:Class="DXGrid_EF4_ServerMode.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Height="350"
Width="525"
Title="MainWindow">
<dxg:GridControl AutoGenerateColumns="AddNew" Name="grid">
<dxg:GridControl.View>
<dxg:TableView ShowTotalSummary="True" />
</dxg:GridControl.View>
</dxg:GridControl>
</Window>
using DevExpress.Data.Linq;
using System;
using System.Windows;
namespace DXGrid_EF4_ServerMode {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
//You can use this demo code to generate a large data set, if currently, you don't have a large database for testing.
NorthwindEntities dataContext = new NorthwindEntities();
try {
for (int i = 0; i < 100000; i++) {
Product product = new Product {
ProductName = string.Format("Product({0})", i),
UnitPrice = new Random().Next(1000),
};
dataContext.Products.AddObject(product);
}
dataContext.SaveChanges();
}
catch (Exception e) {
MessageBox.Show(e.ToString());
}
grid.ItemsSource = new EntityServerModeSource() {
ElementType = typeof(Product),
KeyExpression = "ProductID",
QueryableSource = dataContext.Products
};
}
}
}
Imports DevExpress.Data.Linq
Imports System
Imports System.Windows
Namespace DXGrid_EF4_ServerMode
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
'You can use this demo code to generate a large data set, if currently, you don't have a large database for testing.
Dim dataContext_Renamed As New NorthwindEntities()
Try
For i As Integer = 0 To 99999
Dim product_Renamed As Product = New Product With {.ProductName = String.Format("Product({0})", i), .UnitPrice = (New Random()).Next(1000)}
dataContext_Renamed.Products.AddObject(product_Renamed)
Next i
dataContext_Renamed.SaveChanges()
Catch e As Exception
MessageBox.Show(e.ToString())
End Try
grid.ItemsSource = New EntityServerModeSource() With {.ElementType = GetType(Product), .KeyExpression = "ProductID", .QueryableSource = dataContext_Renamed.Products}
End Sub
End Class
End Namespace