I have a skeleton ASP.NET application with the following:
1) One Telerik report with nothing in it. In the default constructor for this report I added a "Debug.WriteLine" statement so I can see when the constructor is called.
2) One ASPX page, which contains a ReportViewer control in it. In the Page_Load event I create an instance of the report, then set it to the Report property of the ReportViewer.
When ASP.NET Session is set to InProc, all works fine, I look at the Debug window and the constructor is called once. However, when I set the ASP.NET Session to StateServer, I notice the constructor is called three times. Considering I'm planning on putting a few Chart controls in this report and calling a few SQL Server sprocs, this worries me.
Any ideas why using ASP.NET Session = StateServer, the reporting engine would create the report object three times? FYI, this is the Q1 2012 release of Telerik Reporting.
Thanks.
1) One Telerik report with nothing in it. In the default constructor for this report I added a "Debug.WriteLine" statement so I can see when the constructor is called.
2) One ASPX page, which contains a ReportViewer control in it. In the Page_Load event I create an instance of the report, then set it to the Report property of the ReportViewer.
When ASP.NET Session is set to InProc, all works fine, I look at the Debug window and the constructor is called once. However, when I set the ASP.NET Session to StateServer, I notice the constructor is called three times. Considering I'm planning on putting a few Chart controls in this report and calling a few SQL Server sprocs, this worries me.
Any ideas why using ASP.NET Session = StateServer, the reporting engine would create the report object three times? FYI, this is the Q1 2012 release of Telerik Reporting.
Thanks.
4 Answers, 1 is accepted
0
toniq932
Top achievements
Rank 1
answered on 19 Oct 2012, 03:58 PM
You likely do not need this, but here is some of the code I'm using.
EmptyReport.cs - the empty Telerik report
ReportViewer.aspx - the web page containing the ReportViewer
ReportViewer.aspx.cs - the code behind for the web page containing the ReportViewer
Debug Output window when Session = InProc
Debug Output window when Session = StateServer
If you have any ideas/something I can try to stop the ReportViewer creating the report object three times, please let me know. As I said, I'll be calling a few SQL Server sprocs in the report and do not want this happening three times, to show the report just once.
Thanks.
EmptyReport.cs - the empty Telerik report
/// <summary>
/// Summary description for EmptyReport.
/// </summary>
public
partial
class
EmptyReport : Telerik.Reporting.Report {
public
EmptyReport() {
//
// Required for telerik Reporting designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
Debug.WriteLine(
"Report constructor called"
);
}
}
ReportViewer.aspx - the web page containing the ReportViewer
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:ReportViewer
ID
=
"rptViewer"
ZoomMode
=
"FullPage"
ZoomPercent
=
"100"
runat
=
"server"
></
telerik:ReportViewer
>
</
form
>
ReportViewer.aspx.cs - the code behind for the web page containing the ReportViewer
public
partial
class
ReportViewer : System.Web.UI.Page {
protected
void
Page_Load(
object
sender, EventArgs e ) {
Telerik.Reporting.Report rpt =
new
EmptyReport();
rptViewer.Report = rpt;
}
}
Debug Output window when Session = InProc
Report constructor called
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.ActiveReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.ActiveReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.CrystalReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.CrystalReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.XtraReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.XtraReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.XpsRendering\6.0.12.215__a9d7983dfcc261be\Telerik.Reporting.XpsRendering.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.OpenXmlRendering\6.0.12.215__a9d7983dfcc261be\Telerik.Reporting.OpenXmlRendering.dll'
*** ReportProcessor.ProcessReport STARTED ***
*** ProcessReport #0 STARTED ***
*** Report Processing STARTED ***
*** Report Processing DONE in 00:00:00.0001109 ***
*** ProcessReport #0 DONE in 00:00:00.0015288 ***
*** ReportProcessor.ProcessReport DONE in 00:00:00.0026432 ***
*** Get HTMLInteractive Rendering Extension STARTED ***
*** Get HTMLInteractive Rendering Extension DONE in 00:00:00.0000115 ***
*** RenderReport #0 STARTED ***
*** Measure Report (Horizontal) STARTED ***
*** Measure Report (Horizontal) DONE in 00:00:00.0000387 ***
*** Measure Report (Vertical) STARTED ***
*** Measure Report (Vertical) DONE in 00:00:00.0000092 ***
*** RenderReport #0 DONE in 00:00:00.0028014 ***
Debug Output window when Session = StateServer
Report constructor called
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.ActiveReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.ActiveReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.CrystalReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.CrystalReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.ReportConverter.XtraReports\6.0.12.215__a9d7983dfcc261be\Telerik.ReportConverter.XtraReports.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.XpsRendering\6.0.12.215__a9d7983dfcc261be\Telerik.Reporting.XpsRendering.dll'
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Telerik.Reporting.OpenXmlRendering\6.0.12.215__a9d7983dfcc261be\Telerik.Reporting.OpenXmlRendering.dll'
Report constructor called
Report constructor called
*** ReportProcessor.ProcessReport STARTED ***
*** ProcessReport #0 STARTED ***
*** Report Processing STARTED ***
*** Report Processing DONE in 00:00:00.0000976 ***
*** ProcessReport #0 DONE in 00:00:00.0014722 ***
*** ReportProcessor.ProcessReport DONE in 00:00:00.0023631 ***
*** Get HTMLInteractive Rendering Extension STARTED ***
*** Get HTMLInteractive Rendering Extension DONE in 00:00:00.0000115 ***
*** RenderReport #0 STARTED ***
*** Measure Report (Horizontal) STARTED ***
*** Measure Report (Horizontal) DONE in 00:00:00.0000370 ***
*** Measure Report (Vertical) STARTED ***
*** Measure Report (Vertical) DONE in 00:00:00.0000072 ***
*** RenderReport #0 DONE in 00:00:00.0024495 ***
If you have any ideas/something I can try to stop the ReportViewer creating the report object three times, please let me know. As I said, I'll be calling a few SQL Server sprocs in the report and do not want this happening three times, to show the report just once.
Thanks.
0
Hi Adrian,
When working in out-proc session, the report definition is serialized in order to be transported and cached. Each time when needed it is deserialized and instantiated.
Still you should not be concerned about performance because the report objects are relatively small and do not take much time or resource in order to be instantiated (even if they have charts). The processing and rendering operations the ones that take more work to do but they are not called each time the report is instantiated.
All the best,
Elian
the Telerik team
When working in out-proc session, the report definition is serialized in order to be transported and cached. Each time when needed it is deserialized and instantiated.
Still you should not be concerned about performance because the report objects are relatively small and do not take much time or resource in order to be instantiated (even if they have charts). The processing and rendering operations the ones that take more work to do but they are not called each time the report is instantiated.
All the best,
Elian
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!
0
toniq932
Top achievements
Rank 1
answered on 23 Oct 2012, 05:11 PM
Hello Elian, thanks for the reply.
For an OutProc type session, why is a report object created by the report engine three times to serialize it just once? This *is* a concern, to me at least, as I call sprocs in the constructor then add series objects to all of the charts on my report. Considering I'm not using a DataSource control, this seems the best place to retrieve data and "create" the report.
The other point is, if I have a report that's large with, for example, five bar-charts and four pie-charts, and I call a SQL Server sproc to retrieve data to create a series on each chart, do you think I really want the database being "hit" 27 times (nine sprocs x three objects being created) to view just one report? I could return multiple result sets in one sproc call, but still, the database would be accessed more than necessary due to the report object being created so many times by the report engine.
Another oddity, or this is actually a bug, report parameters seem to be broken in an OutProc type session. I added a ReportParameter object to the report's ReportParameters collection, checked it in the NeedDataSource event and it was empty. Of course, with an InProc type session the report parameter is there.
Thanks.
For an OutProc type session, why is a report object created by the report engine three times to serialize it just once? This *is* a concern, to me at least, as I call sprocs in the constructor then add series objects to all of the charts on my report. Considering I'm not using a DataSource control, this seems the best place to retrieve data and "create" the report.
The other point is, if I have a report that's large with, for example, five bar-charts and four pie-charts, and I call a SQL Server sproc to retrieve data to create a series on each chart, do you think I really want the database being "hit" 27 times (nine sprocs x three objects being created) to view just one report? I could return multiple result sets in one sproc call, but still, the database would be accessed more than necessary due to the report object being created so many times by the report engine.
Another oddity, or this is actually a bug, report parameters seem to be broken in an OutProc type session. I added a ReportParameter object to the report's ReportParameters collection, checked it in the NeedDataSource event and it was empty. Of course, with an InProc type session the report parameter is there.
Thanks.
0
Hello Adrian,
The report is instantiated once for the report parameters, once for the processing and once in your .aspx page (when you make a new instance). You can skip the first time by not using an instance but a TypeReportSource instead.
If you want to skip these calls to the server we would recommend to do the following:
Get the code that makes the calls to the server from the constructor and move it to Report_NeedDataSource event. You need to make sure that the report itself has no data-source set, otherwise the event won't be fired. Then in the event you can do the following:
Afterwards you can continue with the initialization of the chart normally.
As to the parameters, can you give us a simple scenario how exactly do you use them (set and get) so we can test it locally and see if there is an issue.
Kind regards,
Elian
the Telerik team
The report is instantiated once for the report parameters, once for the processing and once in your .aspx page (when you make a new instance). You can skip the first time by not using an instance but a TypeReportSource instead.
If you want to skip these calls to the server we would recommend to do the following:
Get the code that makes the calls to the server from the constructor and move it to Report_NeedDataSource event. You need to make sure that the report itself has no data-source set, otherwise the event won't be fired. Then in the event you can do the following:
private
void
YourReport_NeedDataSource(
object
sender, EventArgs e)
{
var procRep = sender
as
Telerik.Reporting.Processing.Report;
var chart = procRep.ItemDefinition.Items.Find(
"YourChart's name here"
,
true
)[0]
as
Telerik.Reporting.Chart;
...
}
As to the parameters, can you give us a simple scenario how exactly do you use them (set and get) so we can test it locally and see if there is an issue.
Kind regards,
Elian
the Telerik team
HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!