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

EntityFramework datasource with Linq

7 Answers 345 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 02 Apr 2014, 04:11 PM
I have a EF 6 datasource configured and working but I'm finding it very limited.  There seems to be no way to query the datasource using Linq from the designer.  I was expecting it to work like the SQL datasource where a query can be specified and then embedded in the report.

7 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 07 Apr 2014, 12:10 PM
Hi Darren,

The EntityDataSource component connects to the underlying data model, and gives you access to all its collections, their relations and additionally declared methods, where you can add custom queries and logic for data retrieving.

The SqlDataSource performs the same task - connects to data, but to make use of the relations between database objects you need to declaratively type queries (equivalent to custom methods for data retrieval written in SQL).

Please elaborate on the feature your are looking for and we will discuss it with our development team.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Darren
Top achievements
Rank 1
answered on 07 Apr 2014, 03:25 PM
I don't want to change the DbContext every time my reporting needs change.   From what I have read, when using the EntityDataSource there is no way to use parameters other than to pass the parameter to a method.  In other words, is there any way to filter one of the IQueryable sources of the DbContext using report parameters without having to create a new method in the context?

Using a SQL source,  if I need to project the data differently, the only thing that changes is the query defined in the report. I don't need to add a new view or stored procedure.
0
Nasko
Telerik team
answered on 10 Apr 2014, 02:12 PM
Hello Darren,

Yes, you need to pass the parameter to a method in the ObjectContext/DbContext class and this is the only way to filter on the database level.
You can define a variety of such methods according to the data that needs to be retrieved or just a single method which can return the different data based on the passed arguments. Then you can map the EntityDataSource component parameters to report parameters and if you need the data differently you would need to change only the report parameters. Please check the Retrieving data from an Entity Data Model with the EntityDataSource component help article which outlines the approach, but note that you can build on top of that to achieve more complicated data retrieval scenarios.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Darren
Top achievements
Rank 1
answered on 10 Apr 2014, 03:04 PM
Thanks for the reply.  Modifying the data context every time I need to change parameters is not a viable solution.  Are the report designer data sources extensible?
0
Nasko
Telerik team
answered on 15 Apr 2014, 11:48 AM
Hello Darren,

You don't have to modify the data context every single time you need to change parameters. It is required to make modifications only when you add a new method in the ObjectContext or DbContext class.
Perhaps it would be best if you could open a separate support ticket where you can zip and attach a sample project demonstrating your scenario and some description on what exactly you are trying to achieve. Then we would be able to give further suggestions.
Also please elaborate further on extending the report designer data sources. Currently, it is possible to use these data source components in Telerik Reporting: Data Source Components.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Darren
Top achievements
Rank 1
answered on 15 Apr 2014, 04:07 PM
By changing parameters, I didn't mean changing the parameter value, I meant changing the types and number of parameters.  I require the ability to put the filtering logic and data projection inside the report. 

When using the SQL datasource wizard there is a dialog that lets you create a query, that step is missing for the Entity Framework data source.  I made the assumption that the EF datasources could be queried from the report.  It appears that it is not currently possible.


0
Nasko
Telerik team
answered on 16 Apr 2014, 02:14 PM
Hello Darren,

Language-Integrated Query (LINQ) is a set of features that extends with query capabilities the language syntax of C# and Visual Basic. Thus LINQ is part of the C# and Visual Basic programing languages. Having in mind that LINQ is a subset of compile languages results in the requirement to compile the LINQ instructions. However you can’t just compile any string input. There are multiple implications in parsing and compiling programing language code that are simply out of the reporting engine scope. So we can’t engage with task to include LINQ interpretation abilities to our EntityDataSource component/wizard.

Generally LINQ seems similar to SQL but this is only on the surface because SQL is interpreted by the SQL server and the reporting engine don’t make any part of the SQL interpretation.

The recommended approach to extend the model to serve the needs of the report is discussed here.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Report Designer (standalone)
Asked by
Darren
Top achievements
Rank 1
Answers by
Stef
Telerik team
Darren
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or