Back to Devexpress

IDrillThroughProcessorAsync Interface

xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-c477e904.md

latest3.9 KB
Original Source

IDrillThroughProcessorAsync Interface

Implements drill-through functionality in web reports and enables asynchronous operations.

Namespace : DevExpress.XtraReports.Web.WebDocumentViewer

Assembly : DevExpress.XtraReports.v25.2.Web.dll

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public interface IDrillThroughProcessorAsync
vb
Public Interface IDrillThroughProcessorAsync

Remarks

You can also create a class that implements the IDrillThroughProcessorAsync interface, to add drill-through functionality to reports in an application. The CreateReportAsync method accepts the DrillThroughContext object and returns a report for display. At application startup you should call the ReportingConfigurationBuilder.UseAsyncEngine method and register a custom service with the ServiceCollectionServiceExtensions.AddScoped<TService,TImplementation> method:

csharp
using System;
using System.Text.Json;
using System.Threading.Tasks;
using DevExpress.XtraReports.Services;
using DevExpress.XtraReports.Web.WebDocumentViewer;
// ...
public class NavigateInfo {
    public string NavigateTo { get; set; }
    public string MasterID { get; set; }
}
public class CustomDrillThroughProcessorAsync : IDrillThroughProcessorAsync {
    readonly IReportProviderAsync reportProviderAsync;

    public CustomDrillThroughProcessorAsync(IReportProviderAsync reportProviderAsync) {
        this.reportProviderAsync = reportProviderAsync;
    }
    public async Task<DrillThroughResult> CreateReportAsync(DrillThroughContext context) {
        NavigateInfo navigateInfo = JsonSerializer.Deserialize<NavigateInfo>(context.CustomData);
        var reportNameToOpen = navigateInfo.NavigateTo == "back" ? "MainReport"
            : navigateInfo.NavigateTo == "details" ? "DetailReport1" : null;
        var report = await reportProviderAsync.GetReportAsync(reportNameToOpen, null) ?? context.Report;

        if(navigateInfo.NavigateTo == "details") {
            int catID = 0;
            Int32.TryParse(navigateInfo.MasterID, out catID);
            report.Parameters["categoryID"].Value = catID;
        }
        return new DrillThroughResult(report);
    }
}
csharp
using Microsoft.Extensions.DependencyInjection;
using DevExpress.XtraReports.Web.WebDocumentViewer;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.ConfigureReportingServices(configurator => {
    configurator.UseAsyncEngine();
});

builder.Services.AddScoped<IDrillThroughProcessorAsync, CustomDrillThroughProcessorAsync>();

var app = builder.Build();

See Also

IDrillThroughProcessorAsync Members

DevExpress.XtraReports.Web.WebDocumentViewer Namespace