Class Module
Base class for modules that can be used to customize the behavior of an item's data form.
Inheritance
Inherited Members
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public abstract class Module
Remarks
Constructor for creating a new instance of the Module class.
Constructors
Module(Section, NavigationContext, IServiceProvider)
Base class for modules that can be used to customize the behavior of an item's data form.
Declaration
protected Module(Section section, NavigationContext navigationContext, IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Section | section | The section the module belongs to. |
| NavigationContext | navigationContext | The navigation context. |
| IServiceProvider | serviceProvider | The service provider used to retrieve other services. |
Remarks
Constructor for creating a new instance of the Module class.
Fields
navigationContext
Declaration
protected readonly NavigationContext navigationContext
Field Value
| Type | Description |
|---|---|
| NavigationContext |
section
Declaration
protected readonly Section section
Field Value
| Type | Description |
|---|---|
| Section |
serviceProvider
Declaration
protected readonly IServiceProvider serviceProvider
Field Value
| Type | Description |
|---|---|
| IServiceProvider |
Methods
CloneAsync(Item, Item, CancellationToken)
Clones the provided item's module data to a new item.
Declaration
public virtual Task CloneAsync(Item item, Item itemCloned, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | The original Item to clone from. |
| Item | itemCloned | The new Item to clone to. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous clone operation. |
GetActionsAsync(CancellationToken)
Gets the module actions.
Declaration
public virtual Task<List<ContextAction>> GetActionsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ContextAction>> |
GetProvidedValues(Dictionary<string, object>)
Retrieves the provided values from the module data.
Declaration
public virtual List<Form.ProvidedValue> GetProvidedValues(Dictionary<string, object> moduleData)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<string, object> | moduleData | The module data containing the provided values. |
Returns
| Type | Description |
|---|---|
| List<Form.ProvidedValue> | A list of Form.ProvidedValue objects. |
GetSectionNotificationCountAsync(CancellationToken)
Retrieves the notification count from the module data.
Declaration
public virtual Task<long> GetSectionNotificationCountAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<long> | The section notification count as an asynchronous operation with a result of type long. |
IsCompletedAsync(Item, Section, CancellationToken)
Determines whether the provided item is completed for the current section.
Declaration
public virtual Task<bool> IsCompletedAsync(Item item, Section currentSection, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | The Item being checked. |
| Section | currentSection | The current Section being displayed. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | A task that represents the asynchronous check operation. The result is a boolean indicating whether the item is completed. |
ProcessActionAsync(ContextAction, IUser, List<string>, List<ProvidedValue>, NavigationContext, CancellationToken)
Declaration
public virtual Task<ContextAction.Result> ProcessActionAsync(ContextAction action, IUser user, List<string> itemIds = null, List<Form.ProvidedValue> controlValues = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ContextAction | action | |
| IUser | user | |
| List<string> | itemIds | |
| List<Form.ProvidedValue> | controlValues | |
| NavigationContext | navigationContext | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ContextAction.Result> |
SaveAsync(Item, Dictionary<string, object>, CancellationToken)
Saves the provided item data and module data.
Declaration
public virtual Task<ModuleSaveResult> SaveAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | The Item being saved. |
| Dictionary<string, object> | moduleData | The module data to be saved. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ModuleSaveResult> | A task that represents the asynchronous save operation. The result contains a ModuleSaveResult indicating whether the item was modified and which fields were modified, if any. |
ValidateAsync(Item, Dictionary<string, object>, CancellationToken)
Validates the provided item data and module data.
Declaration
public virtual Task<List<ValidationError>> ValidateAsync(Item item, Dictionary<string, object> moduleData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | The Item being validated. |
| Dictionary<string, object> | moduleData | The module data to be validated. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<List<ValidationError>> | A task that represents the asynchronous validation operation. The result contains a list of validation errors, if any. |