Save and re-load the saved rdlc report
I am developing an application in WPF in which I need to generate and show reports. I am using RDLC for generating and showing reports. The requirement for reports are
- Should generate and show report.
- The user should be able to save the report (they havent specified the format to save the report.)
- The user should be able to load and view the saved report.
What I am currently doing is that, I am generating a temporary pdf file out of RDLC file to show the report. If the user wish to save the report, the report will be saved as PDF otherwise the temporary PDF file will be deleted. And when user wants to load the saved report, he can, as it is PDF format.
In the program, I am using "winformhost" control in WPF to show the report. A ReportViewer control is also used.
But the problem that I am now facing is that it is rather slow to show a report since we are using the "winformhost" control and PDF format as well.
My question is that How can I increase the performance if I am using this logic of generating and sh开发者_如何学Cowing the report as PDF? If it is not possible, is there any other way in which I can save the report and re-load it whenever I want, which increases the process of report showing?
Thanks in advance, Anish
In my opinion, you can increase your performance by separating concerns. By this I mean, it's better to generate the data set for the report from your custom class rather than directly from DB.
For instance if I want my report to show : the order year- the total number of orders - customer. I will create a class like
class CustomerStatistics
{
public int OrderYear {get;set;}
public int OrderQty {get;set;}
public string CustomerName {get;set;}
}
Once you have done that, you will be able to take advantages of multi-threading. For instance, I know that the calculation of OrderQty will take a while, so I put it in a separate thread.
Besides, you can boost your performance by creating stored-procedures for some heavy calculations in which you need to go through a large data set. If it is the case, you should use set operations like INTERSECT, EXCEPT,etc. to optimize the queries.
That was some of my thoughts.
Cheers.
精彩评论