We have a few reports implemented to work with old ASP.NET Web Forms. Recently we moved to Angular 5 + Asp.Net Web API.
The distinctive feature of those report is the dynamic design based on the data evaluated as a DataSource for that report.
The OLD (web forms) implementation follows steps below:
We have several business entities. As a first step we get the data related to those entities:
var reportData = ReportsUtility.GetReportData(reportParameters);
After that we create an Instance Report Source:
var reportSource = ReportsUtility.GetInstanceReportSource(reportData);
GetInstanceReportSource(..) method implementation detail.
Create a report book:
var reportBook =
new ReportBook();
For each of entities based on data obtained we create specific report instance and transfer the data into it and than attach the report to a report work book:
{
var specificReport = new SpecificReport(entityData);
reportBook.Reports.Add(specificReport);
}
Return newly created Instance Report Source:
return
new InstanceReportSource {ReportDocument = reportBook};
Finally we assign the report source to a report viewer control
New back-end (Restful Service) implementation via CustomResolver is the following:
{
public ReportSource Resolve(string reportJSON)
{
var response = new InstanceReportSource();
var reportParameters = JsonConvert.DeserializeObject<ReportRequestDto>(reportJSON);
if (null == reportJSON) return response;
var reportData = ReportsUtility.GetReportData(reportParameters);
response = ReportsUtility.GetInstanceReportSource(reportData);
return response;
}
}
Everything works smoothly but as per Angular Telerik Report Viewer client lifecycle there are several calls to a back-end service:
GetParameters, CreateInstance, GetDocument ... and each of them internally invokes CustomResolver.Resolve(...) which causes data for the report evaluated several times.
So my question is there is a standard sensibility point or a simple workaround on how to set up DataSource for the report viewer once or at lease during some specific stage?