StartupExtensions.AddDefaultReportingControllers(IMvcBuilder) Method

Explicitly adds the DevExpress.AspNetCore.Reporting assembly as an application part so that reporting controllers are available in the MVC ASP.NET Core application.

Namespace: DevExpress.AspNetCore.Reporting

Assembly: DevExpress.AspNetCore.Reporting.v21.1.dll

Declaration

public static IMvcBuilder AddDefaultReportingControllers(
    this IMvcBuilder builder
)

Parameters

Name Type Description
builder IMvcBuilder

The IMvcBuilder instance this method extends.

Returns

Type Description
IMvcBuilder

A IMvcBuilder that can be used to further configure the MVC services.

Remarks

Use this method to explicitly add the default MVC reporting controllers for processing requests with default routes.

using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
//... 

public class Startup {
//... 
    public void ConfigureServices(IServiceCollection services) {
        services.AddDevExpressControls();
        services.AddMvc().AddDefaultReportingControllers(); 
    }
//...    
}

You can implement custom MVC reporting controllers to perform specific manipulations while processing requests. For this purpose, inherit from the ReportDesignerController, WebDocumentViewerController and/or QueryBuilderController class and specify a URI to each of them using the ReportDesignerHandlerUri(String), ReportPreviewHandlerUri(String) and QueryBuilderHandlerUri(String) methods of the ReportDesignerBuilder object and the HandlerUri(String) method of the WebDocumentViewerBuilder object.

You can customize controllers and change routes, but it is not necessary in most situations. The following table lists controllers that process requests from reporting components, and their default routes:

Component Controller Predefined Route
Report Designer ReportDesignerController DXXRD
Document Viewer WebDocumentViewerController DXXRDV
Query Builder QueryBuilderController DXXQB

An application with End-User Report Designer requires all three controllers for proper operation.

To implement a custom controller, create a descendant of the class listed above and use the HandlerUri property to specify the route:

Component Handler Uri
Report Designer ReportDesignerHandlerUri, ReportPreviewHandlerUri, QueryBuilderHandlerUri
Document Viewer HandlerUri

For more code samples with custom controllers, review the following example:

View Example: ASP.NET Core Reporting - Best Practices

See Also