Class ModuleReport
Represents a module that handles the generation and processing of reports within a section.
Inherited Members
Namespace: DataWeb.Structure.Modules
Assembly: DataWeb.Core.dll
Syntax
public class ModuleReport : Module
Remarks
This class provides methods for validating report data, retrieving report metadata (e.g., name and content type), and processing the report to generate its content as a stream. It integrates with the form service for validation and ensures that the report adheres to the specified structure and format.
Constructors
ModuleReport(Section, NavigationContext, IServiceProvider)
Represents a module that handles the generation and processing of reports within a section.
Declaration
public ModuleReport(Section section, NavigationContext navigationContext, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
Section | section | |
NavigationContext | navigationContext | |
IServiceProvider | serviceProvider |
Remarks
This class provides methods for validating report data, retrieving report metadata (e.g., name and content type), and processing the report to generate its content as a stream. It integrates with the form service for validation and ensures that the report adheres to the specified structure and format.
Methods
GetContentTypeAsync(Item, Dictionary<string, object>, CancellationToken)
Retrieves the content type of the report to be generated.
Declaration
public virtual Task<string> GetContentTypeAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item for which the report content type is being retrieved. |
Dictionary<string, object> | moduleData | The data associated with the report generation. |
CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
Type | Description |
---|---|
Task<string> | A task that represents the asynchronous operation. The task result contains the MIME type of the report content. |
GetReportNameAsync(Item, Dictionary<string, object>, CancellationToken)
Retrieves the name of the report to be generated.
Declaration
public virtual Task<string> GetReportNameAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item for which the report name is being retrieved. |
Dictionary<string, object> | moduleData | The data associated with the report generation. |
CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
Type | Description |
---|---|
Task<string> | A task that represents the asynchronous operation. The task result contains the name of the report file. |
ProcessReportAsync(Item, Dictionary<string, object>, CancellationToken)
Processes the report and generates the report content as a stream.
Declaration
public virtual Task<Stream> ProcessReportAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item for which the report is being generated. |
Dictionary<string, object> | moduleData | The data associated with the report generation. |
CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
Type | Description |
---|---|
Task<Stream> | A task that represents the asynchronous operation. The task result contains the report content as a stream. |
ValidateReportDataAsync(Item, Dictionary<string, object>, CancellationToken)
Validates the data required to generate the report for a specific item.
Declaration
public virtual Task<List<ValidationError>> ValidateReportDataAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item for which the report data is being validated. |
Dictionary<string, object> | moduleData | The data to validate for the report. |
CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
Type | Description |
---|---|
Task<List<ValidationError>> | A task that represents the asynchronous operation. The task result contains a list of validation errors. |