This is a migrated thread and some comments may be shown as answers.

GridView data virtualization using IDataReader

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
DANIIl
Top achievements
Rank 1
DANIIl asked on 11 Aug 2015, 06:10 PM

Hi! I use telerik RadGridView to display Sql-server data. There are a lot of records need to display therefore it is necessary to implement virtualization. We use Entity Framework and for this way work this method:

 _collection = new VirtualQueryableCollectionView(uow.GetQueryableEntities<Cfo>().OrderBy(x => x.ID)) { LoadSize = 6, VirtualItemCount = 100 };

where Cfo - ef entity.

 

But it is necessary display data from tables which are absent in DbContext. I implement IDataReader for sql query. From dataReader I get column names and types, after this I create new Type dynamically and Map DataReader to IList of dynamically type objects: 

_fields = DataReaderHelper.GetDataReaderRows(dr);
var dynamicClass = DynamicTypeBuilder.CreateNewObject(_fields);
var dataReaderList = DataReaderHelper.DataReaderMapToList(dr, dynamicClass.GetType());​

In the end I get this:

_collection = new VirtualQueryableCollectionView(dataReaderList.AsQueryable()) { LoadSize = 6 };

 

But there is a problem: virtualization is not work! VirtualQueryableCollectionView make only one query, like: "Select *From dbo.[SomethingObjects]".

May be somebody know, how to solve this problem! 

 

Ps: there is the second problem using VirtualQueryableCollectionView this ef entities: when grouping does not work virtualization!

2 Answers, 1 is accepted

Sort by
0
DANIIl
Top achievements
Rank 1
answered on 12 Aug 2015, 05:33 AM
May be somebody know, how to implement data virtualization for the SQL-query data (not ef entities)?
0
Dimitrina
Telerik team
answered on 13 Aug 2015, 02:47 PM
Hello,

It seems that in this case data cannot be loaded on demand. Is it an option for you to use RadDataPager?

Regards,
Dimitrina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
DANIIl
Top achievements
Rank 1
Answers by
DANIIl
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or