Welcome to the Xceed Community | Help
Community Search  
More Search Options

Entity Framework + Data Virtualization

Sort Posts: Previous Next
  •  09-27-2011, 2:06 PM Post no. 31098

    Entity Framework + Data Virtualization

    I'm trying to integrate the Ultimate ListBox for WPF with an Entity Framework query, with data virtualization enabled. As I understand it, this is not currently supported - I either have to use a ListDataSourceProvider, which loads the entire data set in memory, or I have to expose my data via a WCF data service and use a WcfDataServicesDataSourceProvider<T>.

    I started writing a custom data source provider inheriting from SyncDataSourceProvider, which seemed to be the simplest option. When I used my provider, however, the ListBox called ExecuteCountQuery 199 times, and ExecuteDataQuery 176 times just to display the window. Each call to ExecuteDataQuery requested a single record.

    I changed my custom provider to inherit from AsyncDataSourceProvider, using exactly the same code, and using the Task Parallel Library to execute the queries on a background thread. With the new provider, the ListBox calls BeginExecuteCountQuery once, and BeginExecuteDataQuery 9 times, with page sizes varying between 7 and 18 records, to display the window.

     

    • Is there a bug with the SyncDataSourceProvider? I would expect it to request a whole page of data as required, not request every individual record separately, with several additional calls to ExecuteCountQuery in between. Since all the calls happen on the UI thread, it makes the application extremely sluggish.

    • Are there any plans to add support for Entity Data Framework, and other IQueryable providers, in the future?

    • Are there any plans to provider better documentation for creating custom data source providers?
  •  10-04-2011, 10:01 AM Post no. 31148 in reply to 31098

    Re: Entity Framework + Data Virtualization

    Hi Richard,

    The behavior you have experienced with the SyncDataSourceProvider is expected.  Even though we are thinking about changing it in order to minimize the number of queries on the data source, it may query more than a single page.  I cannot give you a precise date, but we are planning to solve this issue on a short to mid term schedule.

    We already have some tickets open to simplify the customization of data source providers and to support more types of data sources.  I will create a ticket to have better support for Entity Data Framework.  However, I must admit it is of low priority right now.  Depending on the demands and the needs, this may change.

    We are always trying to improve our documentation.  We know it is still light on this matter.  However, data source provider's customization is a complex topic.  To help us prioritize, could you provide us with the following information:

       - What you had to do to find it the hard way
       - What is missing
       - What needs to be explained in further detail
       - The examples you created in order to find it


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  10-04-2011, 4:31 PM Post no. 31151 in reply to 31148

    Re: Entity Framework + Data Virtualization

    OK, to get this working the hard way:

    1. Some utility methods for working with the TPL:
      http://pastebin.com/MMJHETEN

    2. Some utility methods for working with un-typed IQueryable and Expression objects:
      http://pastebin.com/Hu56hmYc

    3. A custom AsyncDataSourceProvider class:
      http://pastebin.com/jTrXJM00

    4. Using the data source provider from a view-model:
      http://pastebin.com/Fzb7S8P3

     

    As you can see, I haven't implemented GroupCountQuery or StatQuery; the provider still works, and I haven't found an explanation of what they should do.

    I also haven't done anything with the ItemJump and Jump parameters of the DataQuery, or the FilterGroup and Jump parameters of the CountQuery; again, I can't find any documentation of what they are or what I'm supposed to do with them.

    I've had to implement locking around the queries, since the ListBox sometimes issues a request for data after the window has been closed, which was causing an access violation exception. I also had to materialize the results within the lock to avoid a "multiple active readers" error.

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.