Skip to main content

WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage(String, StorageSynchronizationMode) Method

Enables exported document file storage, and specifies a storage path and synchronization mode.

Namespace: DevExpress.AspNetCore.Reporting

Assembly: DevExpress.AspNetCore.Reporting.v24.2.dll

NuGet Package: DevExpress.AspNetCore.Reporting

Declaration

public WebDocumentViewerConfigurationBuilder UseFileExportedDocumentStorage(
    string workingDirectory,
    StorageSynchronizationMode storageSynchronizationMode
)

Parameters

Name Type Description
workingDirectory String

Specifies a path to store the exported documents.

storageSynchronizationMode StorageSynchronizationMode

Specifies a synchronization mode for the file storage.

Returns

Type Description
WebDocumentViewerConfigurationBuilder

A WebDocumentViewerConfigurationBuilder that can be used to adjust the Web Document Viewer services.

Remarks

The Document Viewer uses a memory cache or file storage for the exported document in the following cases:

The exported document is stored in a memory cache and removed from it the first time it is requested. To force the Document Viewer to use a file storage, call the UseFileExportedDocumentStorage method.

The following code demonstrates how to use the UseFileExportedDocumentStorage method to specify a file storage for the Document Viewer.

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

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.AddMvc(); 

builder.Services.ConfigureReportingServices(configurator => {
    configurator.ConfigureWebDocumentViewer(viewerConfigurator => {
        viewerConfigurator.UseFileExportedDocumentStorage(System.IO.Path.Combine(builder.Environment.ContentRootPath, "ExportedDocumentStorage", StorageSynchronizationMode.InterProcess));
    });
});

var app = builder.Build();

The cleaner service periodically searches the cache and file storage for expired documents/exported documents/reports and deletes them. You can use the CacheCleanerSettings and StorageCleanerSettings to specify check interval and expiration time settings. To prevent expired documents from being deleted, call the UseEmptyStoragesCleaner() method to register an empty storage cleaner.

See Also