ICachedReportSourceWebResolver Interface
When implemented by a class, provides a CachedReportSourceWeb object associated with a specified report.
Namespace: DevExpress.XtraReports.Web.WebDocumentViewer
Assembly: DevExpress.XtraReports.v19.1.Web.dll
NuGet Package: DevExpress.Web.Reporting.Common
Declaration
Remarks
When a Document Viewer is requested to display a report by its unique name, it uses a registered IWebDocumentViewerReportResolver object to get the CachedReportSourceWeb object that possesses the corresponding report instance. The CachedReportSourceWeb object generates a report document caching the generated pages.
The following example demonstrates how to implement the IWebDocumentViewerReportResolver interface.
public class CustomCachedReportSourceWebResolver : ICachedReportSourceWebResolver {
public bool TryGetCachedReportSourceWeb(string reportName, out CachedReportSourceWeb CachedReportSourceWeb) {
XtraReport report = null;
if(reportName == "Report1") {
report = new Report1();
}
if(reportName == "Report2") {
report = new Report2();
}
if(reportName == "DocumentMerging") {
var report1 = new Report1();
var cachedReportSource1 = new CachedReportSourceWeb(report1);
cachedReportSource1.CreateDocument();
var report2 = new Report2();
var cachedReportSource2 = new CachedReportSourceWeb(report2);
cachedReportSource2.CreateDocument();
cachedReportSource1.ModifyDocument(x => {
x.AddPages(cachedReportSource2.PrintingSystem.Pages);
}
CachedReportSourceWeb = cachedReportSource1;
return true;
}
if(report == null) {
CachedReportSourceWeb = null;
return false;
}
CachedReportSourceWeb = new CachedReportSourceWeb(report);
return true;
}
}
The following code demonstrates how to register your ICachedReportSourceWebResolver in the .NET Framework application’s Global.asax file.
using DevExpress.XtraReports.Web.WebDocumentViewer;
//...
void Application_Start(object sender, EventArgs e) {
DefaultWebDocumentViewerContainer.Register<ICachedReportSourceWebResolver, CustomCachedReportSourceWebResolver>();
}
The following code demonstrates how to register your ICachedReportSourceWebResolver in the .NET Core application’s Startup.cs file.
using DevExpress.XtraReports.Web.WebDocumentViewer;
//...
public void ConfigureServices(IServiceCollection services) {
//...
services.AddSingleton<ICachedReportSourceWebResolver>(new CustomCachedReportSourceWebResolver());
}
Tip
If the TryGetCachedReportSourceWeb(String, out CachedReportSourceWeb) method returns false, the Document Viewer tries to get a report using an IWebDocumentViewerReportResolver object.