Add in-memory report storage and async report handling
Introduced `InMemoryReportStorageWebExtension` to manage reports in memory, enabling dynamic report storage and retrieval. Updated `ReportViewer.razor` to conditionally render the `DxReportViewer` component and initialize reports asynchronously. Configured dependency injection in `Program.cs` to register `InMemoryReportStorageWebExtension` as a singleton and integrated it with `CustomReportProvider`. Registered `EnvelopeGenerator.ReceiverUI.PredefinedReports.Report` as a trusted class for deserialization. Enhanced `CustomReportProvider` to fetch reports from memory or generate them dynamically using `ReportsFactory`. Added necessary `using` directives and ensured proper report lifecycle management.
This commit is contained in:
@@ -5,7 +5,16 @@ using EnvelopeGenerator.ReceiverUI.PredefinedReports;
|
||||
namespace EnvelopeGenerator.ReceiverUI.Services
|
||||
{
|
||||
public class CustomReportProvider : IReportProviderAsync {
|
||||
private readonly InMemoryReportStorageWebExtension reportStorage;
|
||||
|
||||
public CustomReportProvider(InMemoryReportStorageWebExtension reportStorage) {
|
||||
this.reportStorage = reportStorage;
|
||||
}
|
||||
|
||||
public Task<XtraReport> GetReportAsync(string id, ReportProviderContext context) {
|
||||
if(reportStorage.TryGetReport(id, out var savedReport))
|
||||
return Task.FromResult(savedReport);
|
||||
|
||||
return Task.FromResult(ReportsFactory.GetReport(id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user