Binding Xceed grid to LLBLGen EntityCollection very slow

Posts   
 
    
pat
User
Posts: 215
Joined: 02-Mar-2006
# Posted on: 22-Mar-2010 00:10:13   

Hi,

binding the Xceed Grid to an LLBLGen EntityCollection turns out to have very slow performance.

It's not LLBLGen's fault though since binding it to the DevExpress XtraGrid is blazing fast. So it's more likely the interplay of Xceed and LLBLGen.

Here is the code I use:

public void BidingTest(){
    using (var da = new DataAccessAdapter(true))
    {
        var metaData = new LinqMetaData(da);

        IQueryable<MyCoreEntity> q = (from c in metaData.Core
                                      where c.EntityTypeId == 10
                                      select c);
        var _list = ((ILLBLGenProQuery)q).Execute<EntityCollection<MyCoreEntity>>();

        dataGridControl1.SelectedItems.Clear();
        dataGridControl1.CurrentItem = null;

        // ------------------------------
        // Works but very slow
        // Bind the grid to the composer collection via DataGridCollectionView.
        var dgcvs = new DataGridCollectionViewSource() { Source = _list };
        dataGridControl1.ItemsSource = dgcvs.View;

        // ------------------------------
        // Throws exception: Collections derived from this class aren't thread safe by default.
        // See http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=17606
        //var dgcv = new DataGridCollectionView(_list);
        //dataGridControl1.ItemsSource = dgcv;
        
        // ------------------------------
        // Works very fast
        // DataTable dt = CollectionToDataTable <MyCoreEntity>(_list, "Dt");
        // var dgcv = new DataGridCollectionView(dt.DefaultView);
        // dataGridControl1.ItemsSource = dgcv;
    }
}

public DataTable CollectionToDataTable<TEntity>(EntityCollection<TEntity> collection, string TableName)
    where TEntity : EntityBase2, IEntity2
{
    List<IEntityPropertyProjector> propertyProjectors =
        EntityFields2.ConvertToProjectors(collection.EntityFactoryToUse.CreateFields());
    DataTable dt = new DataTable(TableName);
    collection.DefaultView.CreateProjection(propertyProjectors, dt);
    return dt;
}

Converting the EntityCollection to a DataTable and binding that has very fast performance by the way.

Would anybody have some tips please?

Thanks, Patrick

PS: I posted the same question here by the way http://xceed.com/CS/forums/post/26219.aspx

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Mar-2010 10:25:12   

I'm not sure if there is something we can do about it. Anyway, if you come up with something we should do, we'd be more than happy to help.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Mar-2010 11:40:13   

One thing I noticed (described it in other thread) is that the grid doesn't do any 'IListSource' calls, as it then would bind to the view returned by collection.DefaultView and not to the collection, so try to bind to the collection directly instead of through wrappers, and also, try to bind _list.DefaultView instead of _list.

Frans Bouma | Lead developer LLBLGen Pro