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
Remarks
Initializes a new instance of the StructureService class.
Constructors
StructureService(IAuthorizationService, IReflectionService, IAppErrorService, IServiceProvider, 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, IServiceProvider serviceProvider, 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. |
IServiceProvider | serviceProvider | The service provider used to create module instances. |
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. |
Remarks
Initializes a new instance of the StructureService class.
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. |
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. |
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, CancellationToken)
Retrieves the explorer module for the given section and navigation context
Declaration
public Task<Module> GetExplorerModuleAsync(Section section, NavigationContext navigationContext, 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 |
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. |
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. |
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 |
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 |