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,
Gerald
16 Answers, 1 is accepted
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,
Ross
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
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
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();
InitializeComponent();
DataSource = _db.TodaysDailyBarsPerProduct.ToList();
}
}
UdbEntities is my entity type.
I hope that helps,
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.
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,
Gerald
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="PmasContractManagerEntities" connectionString="metadata=res://*/PmasContractManager.csdl|res://*/PmasContractManager.ssdl|res://*/PmasContractManager.msl;provider=System.Data.SqlClient;provider connection string="Data Source=CABAND820;Initial Catalog=PmasContractManager;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
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());
Pat
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.
Any information regarding this issue is much appreciated.
Thanks!
Ian
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.
Peter
the Telerik team
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?
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.
Regards,
Steve
the Telerik team