Interface IRelationStore
Interface for a store that manages hierarchical relationships between items.
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public interface IRelationStore
Properties
Name
Gets the name of the store.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
ExistsAsync(string, string, string, CancellationToken)
Checks if a relation exists between two items.
Declaration
Task<bool> ExistsAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
string | parentIdMaster | The Id of the parent item. |
string | sectionName | The name of the section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | True if the relation exists, false otherwise. |
GetAncestorsAsync(string, CancellationToken)
Gets the ancestors of the item identified by itemIdMaster.
Declaration
Task<IEnumerable<Relation>> GetAncestorsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation that returns an enumerable collection of relations representing the ancestors of the item identified by itemIdMaster. |
GetChildrenAsync(string, string, CancellationToken)
Gets the children of the item identified by itemIdMaster in the section identified by sectionName.
Declaration
Task<IEnumerable<Relation>> GetChildrenAsync(string itemIdMaster, string sectionName = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
string | sectionName | The name of the section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation that returns an enumerable collection of relations representing the children of the item identified by itemIdMaster in the section identified by sectionName. |
GetCountAsync(string, CancellationToken)
Gets the number of relations for the specified item.
Declaration
Task<long> GetCountAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | The number of relations for the item. |
GetDescendantsAsync(string, CancellationToken)
Gets the descendants of the item identified by itemIdMaster.
Declaration
Task<IEnumerable<Relation>> GetDescendantsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A task representing the asynchronous operation that returns an enumerable collection of relations representing the descendants of the item identified by itemIdMaster. |
GetRelationAsync(RelationFilter, CancellationToken)
Retrieves a relation that matches the specified filter criteria.
Declaration
Task<Relation> GetRelationAsync(RelationFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
RelationFilter | filter | The RelationFilter criteria. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Relation> | The matching relation. |
GetRelationsAsync(RelationFilter, CancellationToken)
Retrieves a list of relations that match the specified filter criteria.
Declaration
Task<IEnumerable<Relation>> GetRelationsAsync(RelationFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
RelationFilter | filter | The RelationFilter criteria. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Relation>> | A list of matching relations. |
MoveAsync(string, string, RelationMoveMode, string, string, int, CancellationToken)
Moves an item to a new location.
Declaration
Task MoveAsync(string itemIdMaster, string targetIdMaster, RelationMoveMode mode, string parentIdMaster, string sectionName, int movingItemsCount, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item to move. |
string | targetIdMaster | The Id of the target item. |
RelationMoveMode | mode | The RelationMoveMode (up or down). |
string | parentIdMaster | The Id of the parent item. |
string | sectionName | The name of the section. |
int | movingItemsCount | The number of items being moved. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
RemoveAsync(string, string, string, CancellationToken)
Removes a relation between the item identified by itemIdMaster and the parent identified by parentIdMaster and sectionName.
Declaration
Task RemoveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
string | parentIdMaster | The Id of the parent item. |
string | sectionName | The name of the section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
RemoveAsync(string, CancellationToken)
Removes a relation between two items.
Declaration
Task RemoveAsync(string itemIdMaster, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SaveAsync(string, string, string, CancellationToken)
Saves a new relation between two items.
Declaration
Task SaveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemIdMaster | The Id of the item. |
string | parentIdMaster | The Id of the parent item. |
string | sectionName | The name of the section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
UpdatePositionAsync(string, double, CancellationToken)
Updates the position of an item in the hierarchy.
Declaration
Task UpdatePositionAsync(string Id, double position, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | Id | The Id of the item. |
double | position | The new position of the item. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |