Class StructureService
Service that provides access to the website's structure, including areas, elements, sections, and views.
Implements
Inherited Members
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public sealed class StructureService : IStructureService
Constructors
StructureService(IAuthorizationService, IReflectionService, IAppErrorService, IAreaStore, IElementStore, ISectionStore, IViewStore)
Service that provides access to the website's structure, including areas, elements, sections, and views.
Declaration
public StructureService(IAuthorizationService authorizationService, IReflectionService reflectionService, IAppErrorService appErrorService, IAreaStore areaStore, IElementStore elementStore, ISectionStore sectionStore, IViewStore viewStore)
Parameters
| Type | Name | Description |
|---|---|---|
| IAuthorizationService | authorizationService | The authorization service used to check user permissions. |
| IReflectionService | reflectionService | The reflection service used to create module instances. |
| IAppErrorService | appErrorService | The error service used to log exceptions. |
| 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. |
Methods
GetAllAreasAsync(CancellationToken)
Gets all areas in the system.
Declaration
public Task<IEnumerable<Area>> GetAllAreasAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Area>> | An IEnumerable<T> of Area objects representing all areas in the system. |
GetAreaAsync(string, CancellationToken)
Gets an area by its name.
Declaration
public Task<Area> GetAreaAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the area to retrieve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Area> | An Area object representing the area with the specified name. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
GetElementAsync(string, CancellationToken)
Gets an element with the specified name.
Declaration
public Task<Element> GetElementAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the element to retrieve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Element> | An Element object representing the element with the specified name. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
GetElementsAsync(CancellationToken)
Gets all elements.
Declaration
public Task<IEnumerable<Element>> GetElementsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Element>> | An IEnumerable<T> of Element objects representing all the elements. |
GetExplorerModuleAsync(Section, NavigationContext, IServiceProvider, CancellationToken)
Retrieves the explorer module for the given section and navigation context.
Declaration
public Task<Module> GetExplorerModuleAsync(Section section, NavigationContext navigationContext, IServiceProvider serviceProvider, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Section | section | The Section to retrieve the explorer module for. |
| NavigationContext | navigationContext | The NavigationContext for the explorer module. |
| IServiceProvider | serviceProvider | The IServiceProvider used to create the module instance. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Module> | The explorer module for the given section and navigation context. |
GetSectionAsync(string, CancellationToken)
Gets a section with the specified name.
Declaration
public Task<Section> GetSectionAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the section to retrieve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Section> | A Section object representing the section with the specified name. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
GetSectionsAsync(CancellationToken)
Gets all sections.
Declaration
public Task<IEnumerable<Section>> GetSectionsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Section>> | An IEnumerable<T> of Section objects representing all the sections. |
GetUserAreasAsync(IUser, CancellationToken)
Gets all areas visible to the specified user.
Declaration
public Task<IEnumerable<Area>> GetUserAreasAsync(IUser user, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The IUser for whom to retrieve areas. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<Area>> | An IEnumerable<T> of Area objects representing the areas visible to the user. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
GetViewAsync(string, CancellationToken)
Retrieves a view with the given name from the view store.
Declaration
public Task<View> GetViewAsync(string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the view to retrieve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<View> | The view with the given name. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
GetViewsAsync(CancellationToken)
Retrieves all views from the view store.
Declaration
public Task<IEnumerable<View>> GetViewsAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<View>> | A collection of all views in the view store. |