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

telerik reporting q1 2014 and MS entity framework 5.0

3 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 13 Mar 2014, 05:16 PM
Hi, 
I'm having serious issues with the telerik reporting in VS. I've created an MS Entity Framework model as a a separate class library as it states in the documentation. 
i'm using the EntityDataSource it finds my library and gets the dbcontext no problem. When i add report parameters it shows me all the fields for the context i selected. 
I assign the fields to the report parameter no problem. the problem happens when i try to preview the report i get the following error:

"an error occurred while invoking the data retrieval method. Try restarting Visual Studio.
A connection string has been provided but constructor with connection string argument could not be found. Either remove the connection string from the data source or provide a constructor which will use that connection string. For design time purposes a constructor that has a connection string and passes it to the base constructor is required."

I'm not sure what this means nor how to fix it. I've created 5 projects and gotten the same behavior. I've uploaded my app.config for review.
any help would be great

Thanks, 
Rick

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>  
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                 initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
  <connectionStrings>
    <add name="AdventureWorks2008R2Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tanortega\sqlexpress2008;initial catalog=AdventureWorks2008R2;persist security info=True;user id=sa;password=dont4get;MultipleActiveResultSets=True;App=EntityFramework&quot;"
      providerName="System.Data.EntityClient" />
    <add name="TelerikReport.My.MySettings.AdventureWorks2008R2"
      connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;data source=tanortega\sqlexpress2008;initial catalog=AdventureWorks2008R2;persist security info=True;user id=sa;password=dont4get;MultipleActiveResultSets=True;App=EntityFramework&amp;quot;&quot; providerName=&quot;System.Data.EntityClient"
      providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>  
</configuration>

3 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 18 Mar 2014, 01:49 PM
Hi Rick,

Please have a look at our EntityDataSource documentation and more importantly the Configuring the database connectivity with the EntityDataSource component help article. It is noted there that if you are using the Database or Model First approaches you will have to add one additional constructor to your context using a partial class. The constructor has to be with a single string argument. The argument must be passed to the parent constructor. You will have to add a new class to your project and add this code:
partial class MyContext
{
  public MyContext (string connectionString)
    : base(connectionString)
  { }
}

I hope this helps.

Regards,
IvanY
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Daniel
Top achievements
Rank 1
answered on 19 Mar 2014, 01:24 PM
thanks for the response Ivan, but am i adding this new class to the web project that contains the reports or in the class library that contains the model?
0
christianamado
Top achievements
Rank 1
answered on 19 Mar 2014, 01:40 PM
Hi Daniel, you must insert the new class in your class library with the model.

Regards.
Tags
General Discussions
Asked by
Rick
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Daniel
Top achievements
Rank 1
christianamado
Top achievements
Rank 1
Share this question
or