New to Telerik Reporting? Download free 30-day trial

EntityDataSource Component Overview

The EntityDataSource component enables data items to connect to an ADO.NET Entity Data Model. This allows seamless integration of Telerik Reporting with applications or websites that utilize the ADO.NET Entity Framework. There are several main benefits when using the EntityDataSource component for connecting to an Entity Data Model:

  • Dedicated design-time support: the EntityDataSource component has its own set of design-time editors, tool windows, and a configuration wizard. In addition to this, EntityDataSource adds support for entity schema in Data Explorer and live data preview of the report in Report Designer.
  • Configuring database connectivity: the EntityDataSource component offers an additional level of control over the database connectivity of the Entity Data Model. You can specify a connection string or a named connection from the configuration file of the main application or website. That ensures EntityDataSource can establish a valid database connection both at design time and when running the report in production.
  • Maintaining ObjectContext/DbContext lifecycle: the EntityDataSource component allows the option to maintain the entire lifecycle of the ObjectContext or DbContext automatically. It can create its own instance of one of the two contexts internally, keep it alive for the duration of the report generation process, and then destroy it automatically when it is no longer needed by the reporting engine.

    When using DbContext by default the context class generated (Database First or Model First) provides only a default (parameterless) constructor. However, for design time purposes a constructor with a connection string (string argument) is needed so that while processing the report the correct connection string can be passed. If Code First is used there is no need for a constructor with a string parameter. That is because this approach uses connection strings without metadata (which is needed for the mapping). This means that the connection string of the context can be directly set to this connection string, without the need to be resolved first. Adding the needed constructor is as simple as it is adding the snippet below:

    partial class AdventureWorksContext
        public AdventureWorksContext(string connectionString) : base(connectionString) {}
    Partial Class AdventureWorksContext
        Public Sub New(connectionString As String)
        End Sub
    End Class

In order to use the Report Designer and Report Wizard the Entity Data Model should be located in a separate class library. The connectionString to the database should be copied to the config file of the report class library for the Data Explorer and Preview to work.

Supported developer platforms

  • .NET Framework 4.0 and above
In this article