xtrareports-400271-web-reporting-asp-net-core-reporting-document-viewer-in-asp-net-applications-customization-register-services-in-the-document-viewer.md
You can register custom and/or predefined services to add specific functionality to the Web Document Viewer.
In the application startup file, call the ServiceCollectionServiceExtensions and WebDocumentViewerConfigurationBuilder class methods as shown below.
var builder = WebApplication.CreateBuilder(args);
builder.Services.ConfigureReportingServices(configurator => {
configurator.ConfigureWebDocumentViewer(viewerConfigurator => {
viewerConfigurator.RegisterWebDocumentViewerDrillThroughProcessor<CustomDrillThroughProcessor>();
});
});
builder.Services.AddSingleton<WebDocumentViewerOperationLogger, MyOperationLogger>();
var app = builder.Build();
See the following topic for more information: Introduction to Dependency Injection in ASP.NET Core.
The table below lists the services you can implement and register in the Document Viewer to resolve a name to a report. Review the following help topic for more information: Open a Report in ASP.NET Core Application.
|
Service
|
Description
|
Registration Methods
| | --- | --- | --- | |
IWebDocumentViewerReportResolver
|
Resolves reports to display in the Web Document Viewer. Does not operate in asynchronous mode.
|
ServiceCollectionServiceExtensions class methods
| |
|
Allows you to implement a service that resolves a report unique name (report URL) to a report instance.
|
ServiceCollectionServiceExtensions class methods
| |
|
Allows you to implement a service that asynchronously resolves a report unique name (report URL) to a report instance.
|
ServiceCollectionServiceExtensions class methods
|
The following table lists the services you can implement and register in the Document Viewer:
|
Service
|
Description
|
Registration Methods
| | --- | --- | --- | |
|
Enables you to implement time settings to clean a cache to store documents and reports.
|
ServiceCollectionServiceExtensions class methods
| |
|
Enables you to perform custom operations with a Document Viewer’s currently opened document.
|
ServiceCollectionServiceExtensions class methods
| |
|
Allows you to restore a data connection on a report’s deserialization.
|
WebDocumentViewerConfigurationBuilder.RegisterConnectionProviderFactory
| |
IExportingAuthorizationService
|
Allows you to provide a custom authorization mechanism for exported documents.
|
ServiceCollectionServiceExtensions class methods
| |
IWebDocumentViewerDrillThroughProcessor
|
Adds drill-through functionality to web reports.
|
WebDocumentViewerConfigurationBuilder.RegisterWebDocumentViewerDrillThroughProcessor
| |
IWebDocumentViewerExceptionHandler
|
Enables you to handle server-side errors in the Web Document Viewer.
|
ServiceCollectionServiceExtensions class methods
| |
IWebDocumentViewerExportResultUriGenerator
|
Allows you to override the default URI that a browser uses to get an export result.
|
ServiceCollectionServiceExtensions class methods
| |
IWebDocumentViewerExportResultUriGeneratorAsync
|
Allows you to override the default URI that a browser uses to get an export result asynchronously.
|
ServiceCollectionServiceExtensions class methods; call the ReportingConfigurationBuilder.UseAsyncEngine method to enable asynchronous mode
| |
|
Enables you to specify time settings to clean a storage to store documents and reports.
|
ServiceCollectionServiceExtensions class methods
| |
WebDocumentViewerOperationLogger
|
Enables you to log events when the Web Document Viewer processes reports and generated documents.
|
ServiceCollectionServiceExtensions class methods
|
The table below lists the WebDocumentViewerConfigurationBuilder‘s methods to register the predefined services that override the default Document Viewer behavior:
| Method | Description |
|---|---|
| UseFileReportStorage | Specifies a path to the report’s file storage. |
| UseFileDocumentStorage | Specifies a path to the report document’s file storage. |
| UseFileExportedDocumentStorage | Specifies a path to the exported document’s file storage. |
| UseEmptyStoragesCleaner | Replaces the service that is used to clean the report and document storage with an empty service to avoid automatic cleaning of this storage. |
| EnablePassingExportOptionsPasswordsToClient | Enables passing PDF/Excel passwords specified in the Report Designer to the Web Document Viewer. |