EntityFramework datasource for RadPivotGrid

3 posts, 0 answers
  1. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 04 Nov 2016 Link to this post

    Hi all,
    i am working with RadPivotGrid with an EntityFramework Datasource

    i would like to add a datasource made like that:
    this.queryableDataProvider = new QueryableDataProvider()
          Source = DBContext.PERSON.Include(e => e.TASKS)                                         

    when i start the program in the RadPivotGrid and in the FieldList i only see PEERSON and i am unable to see any further level of my DataSource (everything that is in the "include" linq query.

    all the EDM Model is tested in many years and works great with all the telerik controls but i am unable to use RadPivotGrid

    am i missing some points?


  2. Polya
    Polya avatar
    242 posts

    Posted 08 Nov 2016 Link to this post

    Hi Andrea,

    I suppose this is due to the fact that a projection onto a mapped entity is not allowed. However, a projection onto an data transfer object( DTO ) is allowed. Calling Include should include properties onto the type Person which probably results in a poco object creation, while the provider will work with the Person objects.

    That said, entirely new objects are used(not the ones used in your entity framework). If my assumption is correct, you can use our LocalDataSourceProvider and apply ToList() at the end of your query. That's the only way to get it work with the new objects. In case you want to use QueryableDataProvider, you will have to pass the same object types as the ones from your Entity Framework.
    Hope this helps.

    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. Andrea
    Andrea avatar
    7 posts
    Member since:
    Jan 2016

    Posted 09 Nov 2016 in reply to Polya Link to this post

    Hi Polya,
    thank for your reply, in the end i managed it in another way.
    I share just i case someone have the same issue.
    I create a variable of type var and save the query result made by LINQ in it,
    next i convert this var to a DataTable with a custom metod and next pass the datatable as Datasource.
    Thank you very much
Back to Top