Use Telerik Reporting in .Net Core with Entity Data Model
Environment
Product Version | 13.0.19.116 and above |
Product | Progress® Telerik® Reporting |
Description
The EntityDataSource component is dedicated to the Entity Framework and cannot work with Entity Framework Core. The latter can be used with .NET Framework 4.5+, .NET Core Framework and .NET Standard - EF Core Introduction.
Solution
Use an ObjectDataSource component instead, which supports the Entity Framework Core to fetch the data and return it in one of the formats that the ObjectDataSource allows.
If you would like to be able to use the same ObjectDataSource to design your reports in the
Standalone Report Designer, the project should be built against .NET Standard 2.0. This technical
limitation comes from the fact that the Standalone Report Designer is a WPF application with Windows Forms Report Viewer built against
.NET Framework, and can resolve assemblies built with .NET Standard - see
.NET implementation support. The Stanandalone Report Designer cannot recognize assemblies that target .NET Core or .NET Standard 2.1. For that reason, the ObjectDataSource assembly should reference .NET Standard 2.0.
It is necessary to register the assembly in the designer's configuration file as explained in the
Extending Report Designer article. It also may be necessary to undertake
the steps described in the Assembly Used in ObjectDataSource is Not Loaded by the Standalone Report Designer
KB article.
As an example, our tests with an ObjectDataSource defined in .NET Standard 2.0 ClassLibrary project utilizing Microsoft.EntityFrameworkCore 2.2.0 revealed that it was sufficient for design purposes to add the ClassLibrary project itself and the assembly 'Microsoft.EntityFrameworkCore' with version 2.2 to the designer's folder.
For preview purposes, however, it was necessary to add all the dependencies of 'Microsoft.EntityFrameworkCore' package in the folder of the designer as well. Generally, in .NET Core/Standard projects these dependencies are added as NuGet packages, and for that reason cannot be found in the Global Assembly Cache (GAC) where a regular .NET application will look for them by default.