Class Element
Represents an element in the application.
Inherited Members
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public sealed class Element
Constructors
Element(IReflectionService, IAppErrorService, IAuthorizationService, IAreaStore, IElementStore, ISectionStore, IViewStore)
Represents an element in the application.
Declaration
public Element(IReflectionService reflectionService, IAppErrorService appErrorService, IAuthorizationService authorizationService, IAreaStore areaStore, IElementStore elementStore, ISectionStore sectionStore, IViewStore viewStore)
Parameters
| Type | Name | Description |
|---|---|---|
| IReflectionService | reflectionService | The IReflectionService instance used for reflection operations. |
| IAppErrorService | appErrorService | The IAppErrorService instance used for error handling. |
| IAuthorizationService | authorizationService | The authorization service used to check permissions. |
| IAreaStore | areaStore | The store used to access area data. |
| IElementStore | elementStore | The store used to access element data. |
| ISectionStore | sectionStore | The store used to access section data. |
| IViewStore | viewStore | The store used to access view data. |
Properties
IdMaster
Gets or sets the unique identifier.
Declaration
public string IdMaster { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
IsCompleted
Gets or sets a value indicating whether the element is completed.
Declaration
public bool IsCompleted { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
Gets or sets the name of the element.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Status
Gets or sets the status of the element.
Declaration
public ItemStatus Status { get; set; }
Property Value
| Type | Description |
|---|---|
| ItemStatus |
Title
Gets or sets the title of the element.
Declaration
public string Title { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetAllSectionsAsync(CancellationToken)
Asynchronously retrieves all sections associated with the element.
Declaration
public Task<IEnumerable<Section>> GetAllSectionsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Section>> | An enumerable of sections associated with the element. |
GetUserSectionsAsync(IUser, CancellationToken)
Asynchronously retrieves the sections associated with the element that the specified user has permission to see.
Declaration
public Task<IEnumerable<Section>> GetUserSectionsAsync(IUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The IUser for which to retrieve sections. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Section>> | An enumerable of sections the specified user has permission to see. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
Init(ElementData)
Initializes the element with the specified data.
Declaration
public void Init(ElementData elementData)
Parameters
| Type | Name | Description |
|---|---|---|
| ElementData | elementData | The ElementData to use to initialize the element. |
InitAsync(string, CancellationToken)
Asynchronously initializes the element with the specified name.
Declaration
public Task InitAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the element to initialize. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
| InvalidOperationException | Thrown when no element with the specified name is found. |