Back to Devexpress

WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage(String, StorageSynchronizationMode) Method

xtrareports-devexpress-dot-aspnetcore-dot-reporting-dot-webdocumentviewerconfigurationbuilder-dot-usefileexporteddocumentstorage-x28-string-storagesynchronizationmode-x29.md

latest4.9 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.AspNetCore.Reporting

Declaration

csharp
public WebDocumentViewerConfigurationBuilder UseFileExportedDocumentStorage(
    string workingDirectory,
    StorageSynchronizationMode storageSynchronizationMode
)
vb
Public Function UseFileExportedDocumentStorage(
    workingDirectory As String,
    storageSynchronizationMode As StorageSynchronizationMode
) As WebDocumentViewerConfigurationBuilder

Parameters

NameTypeDescription
workingDirectoryString

Specifies a path to store the exported documents.

| | storageSynchronizationMode | StorageSynchronizationMode |

Specifies a synchronization mode for the file storage.

|

Returns

TypeDescription
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.

csharp
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

UseFileDocumentStorage

UseFileReportStorage

WebDocumentViewerConfigurationBuilder Class

WebDocumentViewerConfigurationBuilder Members

DevExpress.AspNetCore.Reporting Namespace