Telerik Reporting together with MS Entity Framework

17 posts, 0 answers
  1. Gerald
    Gerald avatar
    13 posts
    Member since:
    Mar 2009

    Posted 16 Mar 2009 Link to this post

    Hello community,

    is it possible to use Telerik Reporting with Microsoft's Entity Framework? I tried it, but the report couldn't retrieve data from the database.
    If it is possible could somebody give me directions how to do it or where to investigate further?

    Thanks in advance and kind regards,

  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 20 Mar 2009 Link to this post

    Hello Gerald,

    We will need some more information about this issue. How exactly did you try to connect? If it is possible, can you send us your project or a sample project that reproduces what you are experiencing. Any other information that you consider might be helpful will be greatly appreciated as well.

    I am pretty sure that you have checked out the documentation, but in case you have not then the following might be helpful:

    Connecting Data to a Report

    We are looking forward to hearing from you.

    All the best,
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Gerald
    Gerald avatar
    13 posts
    Member since:
    Mar 2009

    Posted 24 Mar 2009 Link to this post


    after some more tries I figured out how Telerik Reporting and the MS Entity Framework work together.

    Anyway, thanks for the response, Ross.

    Kind regards, Gerald
  4. Jason
    Jason avatar
    12 posts
    Member since:
    Aug 2007

    Posted 14 Apr 2009 Link to this post

    I need to get this to work also. How did you do it ?
  5. Gerald
    Gerald avatar
    13 posts
    Member since:
    Mar 2009

    Posted 15 Apr 2009 Link to this post

    Hello Hector,

    I solved this programmatically. The report class got a member for the entity class which I initialized in the report's constructor. After the call to InitializeComponent() I set the DataSource for the report.


    public partial class DataBindingReport : Telerik.Reporting.Report





        private UdbEntities _db;
        public DataBindingReport()




            _db =

    new UdbEntities();




            DataSource = _db.TodaysDailyBarsPerProduct.ToList();



    UdbEntities is my entity type.

    I hope that helps,




  6. Jason
    Jason avatar
    12 posts
    Member since:
    Aug 2007

    Posted 15 Apr 2009 Link to this post

    Thanks Gerald,
    I did what you put but its throwing an exception when you I hit the preview tab.

    "The specified named connection is either not found in the configuration. not intended to be used with the EntityClient provider, or not valid."

    I did put a app.config file in my report project.

    I also noticed you initialized _db before the initializecomponent() function is called.


  7. Gerald
    Gerald avatar
    13 posts
    Member since:
    Mar 2009

    Posted 15 Apr 2009 Link to this post

    Hello Hector,

    if you divided your project into a class library project and a report viewer project then you will have to copy the connection string from the app.config of your library to the app.config of the report viewer.

    Hope it helps,

  8. Jason
    Jason avatar
    12 posts
    Member since:
    Aug 2007

    Posted 15 Apr 2009 Link to this post

    I did that when I added the app.config file. Here is my app.config/

    <?xml version="1.0" encoding="utf-8" ?>
            <add name="PmasContractManagerEntities" connectionString="metadata=res://*/PmasContractManager.csdl|res://*/PmasContractManager.ssdl|res://*/PmasContractManager.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=CABAND820;Initial Catalog=PmasContractManager;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  9. Patrick McGouirk
    Patrick McGouirk avatar
    1 posts
    Member since:
    Aug 2008

    Posted 15 Apr 2009 Link to this post


    Here is my solution at the moment since I am having the exact same issue.  Something screwy with reporting stuff appears to be preventing the the code from reading either the web.config or app.config (pending on your deployment).  I was able to get around the errors by using the EntityconnectionStringBuilder from within the code.  While I REALLY don't like this solution, it has allowed me to move beyond the errors.

                MyEntities entityContext;          
                EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder();
                builder.Provider = "System.Data.SqlClient";
                builder.ProviderConnectionString = @"Data Source=myServerName;Initial Catalog=myDataBase;Integrated Security=True;MultipleActiveResultSets=True";
                builder.Metadata = @"res://*/myEntityModel.csdl|res://*/myEntityModel.ssdl|res://*/myEntityModel.msl";            
                context = new myEntities(builder.ToString());


  10. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jan 2009

    Posted 19 Aug 2009 Link to this post

    So you must have manually designed your report without the preview available?  Then how do the names come out when you have child entities?
  11. fayssal el moufatich
    fayssal el moufatich avatar
    3 posts
    Member since:
    Sep 2009

    Posted 28 Sep 2009 Link to this post

    It seems the configuration file is read only when it is placed in a project that initiates the .NET runtime (Console app or a Win Forms app). Otherwise, the entities class should be configured manually.

    Thanks for the code snippet Patrick!

  12. James Reategui
    James Reategui avatar
    12 posts
    Member since:
    Oct 2008

    Posted 09 Mar 2011 Link to this post

    I get the same problem in the designer Preview, although once I run the app the report shows up fine.

    I have my core library project seperate from the web project. All the Data layer with Entity Framework is in the Core library. I added the connection string in the web.config. When I run the app, the report is generated fine, it is only in the designer Preview function that it does not work.

    Seems like the designer is broken when it tries to talk to EF. Works fine with Linq2Sql though... I keep finding EF is still not ready for production. Running the latest versions of everything to date btw.
  13. ITLackey
    ITLackey avatar
    9 posts
    Member since:
    Jan 2011

    Posted 10 May 2011 Link to this post

    I am having the same problem as well. It appears that the Preview tab of the report designer is not able to access the EF embedded resources. I have tried several changes to the config file to attempt to resolve this with no luck. At this point it is looking like a bug in the report previewer, because like the previous poster (James), everything works fine at run time. I am running the latest of Telerik Reports and VS2010 SP1.

    Any information regarding this issue is much appreciated.

  14. Peter
    Peter avatar
    1629 posts

    Posted 13 May 2011 Link to this post

    Hi ITLackey,

    Currently when EntityDataSource component is used the EF Model should be located in a separate class library in order the report designer previews to work properly. This limitation is caused by Visual Studio Type.GetType and we have to further investigate the issue and undertake appropriate actions.

    Please excuse us for the temporary inconvenience.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. Todd
    Todd avatar
    4 posts
    Member since:
    Jun 2010

    Posted 04 Feb 2012 Link to this post

    Has this issue been resolved yet?
    I've been trying for entire day to use the report designer with a entitydatasource and if it isn't one problem, it's another.
    I've tried with a class library project in which I get the "specifed connection is not found..." problem.
    If i try it in a wpf application, I get the "source has not been specified" problem.
    It seems that no matter what you do, it's not possible to design a report with preview using the entitydatasource.
    Do you guys have a sample project that uses the entitydatasource (with preview) sucessfully?
  16. Steve
    Steve avatar
    10941 posts

    Posted 06 Feb 2012 Link to this post

    Hello Todd,

    In which project is Entity Model located. Generally to use the Report Designer and Report Wizard the Entity Data Model should be located in a separate project. The connectionString to the database should be copied to the config file of the reports project for the Data Explorer and Preview to work. Any extension methods should be located in the same project as the model. Additionally in some rare cases you may have to restart Visual Studio to get this running.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  17. Chris
    Chris avatar
    10 posts
    Member since:
    Jul 2011

    Posted 07 Mar 2012 Link to this post

    This same exact scenario is happening to me when trying to utilize an openaccess domain context from within a report library project. For whatever reason the designer preview is not able to see into the App.config (or a Web.config file for that matter) to pull in the connection string. I have separate projects for my data layer (open access domain model), report library (class library) and an project with the report viewer, all of the references and usings are set up properly and each project has a proper config file with the connection string inside, but the preview does not work, and causes the "a connection string was referneced....but could not be resolved through web/app.config". I'm using an openaccessdatasource as my main report data source, but in a few of my custom user functions I'm using linq to query against the openaccess context in order to do some value converting. This is where the error is, when accessing the context from code behind of a report. Please let me know a proper workaround, Thanks!
Back to Top