Blazing fast performance with RadGridView for WPF 4.0 and Entity Framework 4.0

Thursday, April 15, 2010 by Vladimir Enchev | Comments 3

Just before our upcoming release of Q1 2010 SP1 (early next week), I’ve decided to check how RadGridView for WPF will handle complex Entity Framework 4.0 query with almost 2 million records:

public class MyDataContext
{
    IQueryable _Data;
    public IQueryable Data
    {
        get
        {
            if (_Data == null)
            {
                var northwindEntities = new NorthwindEntities();
                var queryable = from o in northwindEntities.Orders
                               from od in northwindEntities.Order_Details
                                select new
                                {
                                    od.OrderID,
                                    od.ProductID,
                                    od.UnitPrice,
                                    od.Quantity,
                                    od.Discount,
                                    o.CustomerID,
                                    o.EmployeeID,
                                    o.OrderDate
                                };
                _Data = queryable.OrderBy(i => i.OrderID);
            }
 
            return _Data;
        }
    }
}


The grid is bound completely codeless in XAML using RadDataPager with PageSize set to 50:

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:WpfApplication1" xmlns:my1="clr-namespace:System;assembly=mscorlib">
<
Window.Resources>
<
my:MyDataContext x:Key="dataContext" />
</
Window.Resources>
<
Grid DataContext="{StaticResource dataContext}">
<
Grid.RowDefinitions>
<
RowDefinition />
<
RowDefinition Height="Auto" />
</
Grid.RowDefinitions>
<
telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding Data}" />
<
telerik:RadDataPager PageSize="50" Source="{Binding Items,ElementName=RadGridView1}" Grid.Row="1"/>
</
Grid>
</
Window>

The result: Blazing fast sorting, paging, grouping and filtering of all data applied directly to the data-base server!

image

 

3 Comments

  • Scott Christian 14 Sep
    Is there a way to get similar performance out of a RadComboBox and entity framework perhaps without the data pager?

    thanks
    Scott Christian
  • Scott Christian 14 Sep
    Is there a way to get similar performance out of a RadComboBox and entity framework perhaps without the data pager?

    thanks
    Scott Christian
  • Ahmad Iqbal 07 Feb
    Is there a way to make this grid editable as well? I'm trying but haven't succeeded as yet.

Add comment

  1. Formatting options
       
     
     
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)