GridView data virtualization using IDataReader

3 posts, 0 answers
  1. DANIIl
    DANIIl avatar
    14 posts
    Member since:
    Apr 2015

    Posted 11 Aug 2015 Link to this post

    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. DANIIl
    DANIIl avatar
    14 posts
    Member since:
    Apr 2015

    Posted 12 Aug 2015 in reply to DANIIl Link to this post

    May be somebody know, how to implement data virtualization for the SQL-query data (not ef entities)?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 13 Aug 2015 Link to this post

    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
Back to Top