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