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

EntityFramework datasource for RadPivotGrid

2 Answers 83 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 04 Nov 2016, 08:11 AM

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?

Thanks
Andrea

2 Answers, 1 is accepted

Sort by
0
Polya
Telerik team
answered on 08 Nov 2016, 03:49 PM
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.

Regards,
Polya
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Andrea
Top achievements
Rank 1
answered on 09 Nov 2016, 07:34 PM
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
Tags
PivotGrid
Asked by
Andrea
Top achievements
Rank 1
Answers by
Polya
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or