Есть ли способ улучшить производительность локального отчета или даже альтернативы, если нет? Текущий код для преобразования rdlc в pdf ниже. Ищете решение в течение довольно долгого времени, но общий консенсус, похоже, заключается в том, что он просто медленный, спасибо за любую помощь.Локальный отчет rdlc в pdf очень медленный
public byte[] genReportBytes(int id, string fromm, string too, string filetype)
{
reportDetails repD = new reportDetails();
repD = getOneReport(id);
LocalReport report = new LocalReport();
if (fromm != null)
repD.ParametersCommandLine = "@startdate=" + fromm;
if (too != null)
repD.ParametersCommandLine += " @enddate=" + too;
string RDLCPath = ConfigurationManager.AppSettings["RDLCPath"];
string ReportOutputPath = ConfigurationManager.AppSettings["ReportOutputPath"];
string RDLCName = repD.RDLCName;
RDLCPath += @"\" + RDLCName;
report.ReportPath = RDLCPath;
string sqlGet = repD.SQLOfReport;
report.DataSources.Add(new ReportDataSource(repD.DatasetName, getReportData(sqlGet, repD.ParametersCommandLine)));
// export to byte array
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
string deviceInf = "";
byte[] bytes;
string extension;
if (filetype == "pdf")
{
deviceInf = "<DeviceInfo><PageHeight>8.5in</PageHeight><PageWidth>11in</PageWidth><MarginLeft>0in</MarginLeft><MarginRight>0in</MarginRight></DeviceInfo>";
//fileName = ReportOutputPath + @"\" + repD.NameOfOutputPDF + ".PDF";
bytes = report.Render("pdf", deviceInf, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
else
{
//fileName = ReportOutputPath + @"\" + repD.NameOfOutputPDF + ".XLS";
bytes = report.Render(
"Excel", null, out mimeType, out encoding,
out extension,
out streamids, out warnings);
}
return bytes;
}
Эти две строки 'ParametersCommandLine' заставляют меня подозревать, что ваш код может быть уязвим для [SQL Injection] (http://www.troyhunt.com/2013/07/everything-you-wanted-to-know-about- sql.html). Как выглядит ваш метод getReportData? –
Если вы используете ***. NET 4.5 в приложении ASP.NET *** без особого использования _динамических типов для сериализации и десериализации. Может быть, можно использовать ' ' –
Kiquenet
@Kiquenet Code review означает просмотр рабочего кода, также могут потребоваться улучшения производительности. Приятный пример: http://codereview.stackexchange.com/questions/104879/creating-a-numeric-phone-keypad/104882#104882 – chillworld