The ReportGallery class maintains a list of registered reports and creates a ReportQuery based on a given report code.  When a ReportQuery is created, it is also cached by the ReportGallery and can be retrieved by calling GetReportQuery and providing the queryId.


This example shows how to create a ReportQuery, generate the report and return a PDF.

var query = ReportGallery.NewReportQuery(“InvoiceReport”);

var builder = new ReportBuilder();

var document = builder.BuildReport(query);

var pdfStream = document.ToPdf();

return new FileStreamResult(pdfStream, “application/pdf”);



The number of minutes to cache report queries.  The default is 20 minutes.


A delegate that may be used to cache ReportQuery instances in a cache.  By default, ReportQuery instances are stored in a static memory cache for 20 minutes.


If SaveToCache is used to implement an alternative caching method, then LoadFromCache must also be implemented to load ReportQuery instances from the cache.


When a ReportQuery is created by the ReportGallery, it will call LoadReportDocument to allow the Document to be populated from a database.  If LoadReportDocument is not set or if LoadReportDocument does not load the ReportQuery’s Document property, then the Document will be loaded from the Url of a registered report.



Registers a report definition in the report gallery.


Gets a list of registered reports. A report can have a group and a role specified which can be used when getting a list of reports.  This list can then be used to create a report menu. Returns a list of ReportDefinition objects.


Registers all reports in the specified XML file.


Gets the report definition for the specified report code.


Retrieves a report query from the cache.


Creates a report query by loading the report definition for the specified code.  If a reportId is specified, then the report query will use this id.


Creates a report query by loading the report definition for the specified code and loading the specified published report data.

Click to see Comments

Help comments powered by Disqus