New to Telerik Reporting? Download free 30-day trial

Using EFCore in Telerik Reporting

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.

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.

Standalone Report Designer

  • Standalone Report Designer for .NET Framework

    To use the same ObjectDataSource to design reports in the Standalone Report Designer for .NET Framework, the project should be built against .NET Standard 2.0. This technical limitation comes from the fact that this 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.

  • Standalone Report Designer for .NET

    The Standalone Report Designer for .NET is built on .NET 8 and can thus resolve assemblies built targeting .NET Core up to .NET 8, or .NET Standard.

It is necessary to register the assembly in the designer's configuration file as explained in the Extending Report Designer 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 the 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.

Web Report Designer

The above approach can also be implemented in the Web Report Designer and there are no limitations to the target framework in this scenario since the Class Library project will be resolved by the main project hosting the Web Report Designer. For example, if the project with the Web Report Designer is using .NET 7, there will be no issue with creating a class library that also targets .NET 7, which would be a problem with the Standalone Report Designer for .NET.

For details on how to use the ObjectDataSource component in the Web Report Designer, we recommend following the ObjectDataSource Wizard in the Web Report Designer tutorial.

There is no need to add additional packages in this scenario, as long as they are added to the class library, they will be loaded by the project hosting the Web Report Designer provided that the class library is added as a Project Reference.

See Also

In this article