Interface INavigationQueryService
Placeholder for sharing logic between the document and media navigation services for querying the navigation structure.
Namespace: Umbraco.Cms.Core.Services.Navigation
Assembly: Umbraco.Core.dll
Syntax
public interface INavigationQueryService
Remarks
This interface defines methods for traversing and querying the main navigation structure, including operations for retrieving parent, children, descendants, ancestors, siblings, and level information for content nodes.
Methods
View SourceTryGetAncestorsKeys(Guid, out IEnumerable<Guid>)
Attempts to get all ancestor node keys of a child node.
Declaration
bool TryGetAncestorsKeys(Guid childKey, out IEnumerable<Guid> ancestorsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | childKey | The unique identifier of the child node. |
| IEnumerable<Guid> | ancestorsKeys | When this method returns, contains the collection of ancestor node keys (parent, grandparent, etc.); or an empty collection if the child doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetAncestorsKeysOfType(Guid, string, out IEnumerable<Guid>)
Attempts to get all ancestor node keys of a specific content type for a given node.
Declaration
bool TryGetAncestorsKeysOfType(Guid parentKey, string contentTypeAlias, out IEnumerable<Guid> ancestorsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the node to find ancestors for. |
| string | contentTypeAlias | The alias of the content type to filter by. |
| IEnumerable<Guid> | ancestorsKeys | When this method returns, contains the collection of ancestor node keys of the specified content type; or an empty collection if the node or content type doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetAncestorsOrSelfKeys(Guid, out IEnumerable<Guid>)
Attempts to get all ancestor node keys including the child node itself.
Declaration
bool TryGetAncestorsOrSelfKeys(Guid childKey, out IEnumerable<Guid> ancestorsOrSelfKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | childKey | The unique identifier of the child node. |
| IEnumerable<Guid> | ancestorsOrSelfKeys | When this method returns, contains the child's key followed by all its ancestor keys; or an empty collection if the child doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetChildrenKeys(Guid, out IEnumerable<Guid>)
Attempts to get all child node keys of a parent node.
Declaration
bool TryGetChildrenKeys(Guid parentKey, out IEnumerable<Guid> childrenKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent node. |
| IEnumerable<Guid> | childrenKeys | When this method returns, contains the collection of child node keys ordered by sort order; or an empty collection if the parent doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetChildrenKeysOfType(Guid, string, out IEnumerable<Guid>)
Attempts to get all child node keys of a specific content type under a parent node.
Declaration
bool TryGetChildrenKeysOfType(Guid parentKey, string contentTypeAlias, out IEnumerable<Guid> childrenKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent node. |
| string | contentTypeAlias | The alias of the content type to filter by. |
| IEnumerable<Guid> | childrenKeys | When this method returns, contains the collection of child node keys of the specified content type, ordered by sort order; or an empty collection if the parent or content type doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetDescendantsKeys(Guid, out IEnumerable<Guid>)
Attempts to get all descendant node keys of a parent node.
Declaration
bool TryGetDescendantsKeys(Guid parentKey, out IEnumerable<Guid> descendantsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent node. |
| IEnumerable<Guid> | descendantsKeys | When this method returns, contains the collection of all descendant node keys (children, grandchildren, etc.); or an empty collection if the parent doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetDescendantsKeysOfType(Guid, string, out IEnumerable<Guid>)
Attempts to get all descendant node keys of a specific content type under a parent node.
Declaration
bool TryGetDescendantsKeysOfType(Guid parentKey, string contentTypeAlias, out IEnumerable<Guid> descendantsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent node. |
| string | contentTypeAlias | The alias of the content type to filter by. |
| IEnumerable<Guid> | descendantsKeys | When this method returns, contains the collection of descendant node keys of the specified content type; or an empty collection if the parent or content type doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetDescendantsKeysOrSelfKeys(Guid, out IEnumerable<Guid>)
Attempts to get all descendant node keys including the parent node itself.
Declaration
bool TryGetDescendantsKeysOrSelfKeys(Guid parentKey, out IEnumerable<Guid> descendantsOrSelfKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent node. |
| IEnumerable<Guid> | descendantsOrSelfKeys | When this method returns, contains the parent's key followed by all its descendant keys; or an empty collection if the parent doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetLevel(Guid, out int?)
Attempts to get the hierarchical level of a content node.
Declaration
bool TryGetLevel(Guid contentKey, out int? level)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentKey | The unique identifier of the content node. |
| int? | level | When this method returns, contains the level of the node (1 for root-level nodes,
2 for their children, etc.); or |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetParentKey(Guid, out Guid?)
Attempts to get the parent key of a child node.
Declaration
bool TryGetParentKey(Guid childKey, out Guid? parentKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | childKey | The unique identifier of the child node. |
| Guid? | parentKey | When this method returns, contains the parent's unique identifier if the child exists;
otherwise, |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetRootKeys(out IEnumerable<Guid>)
Attempts to get all root-level node keys.
Declaration
bool TryGetRootKeys(out IEnumerable<Guid> rootKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Guid> | rootKeys | When this method returns, contains the collection of root node keys ordered by sort order. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetRootKeysOfType(string, out IEnumerable<Guid>)
Attempts to get all root-level node keys of a specific content type.
Declaration
bool TryGetRootKeysOfType(string contentTypeAlias, out IEnumerable<Guid> rootKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contentTypeAlias | The alias of the content type to filter by. |
| IEnumerable<Guid> | rootKeys | When this method returns, contains the collection of root node keys of the specified content type, ordered by sort order; or an empty collection if the content type doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetSiblingsKeys(Guid, out IEnumerable<Guid>)
Attempts to get all sibling node keys of a node.
Declaration
bool TryGetSiblingsKeys(Guid key, out IEnumerable<Guid> siblingsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the node. |
| IEnumerable<Guid> | siblingsKeys | When this method returns, contains the collection of sibling node keys (excluding the node itself), ordered by sort order; or an empty collection if the node doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|
TryGetSiblingsKeysOfType(Guid, string, out IEnumerable<Guid>)
Attempts to get all sibling node keys of a specific content type for a given node.
Declaration
bool TryGetSiblingsKeysOfType(Guid key, string contentTypeAlias, out IEnumerable<Guid> siblingsKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the node. |
| string | contentTypeAlias | The alias of the content type to filter by. |
| IEnumerable<Guid> | siblingsKeys | When this method returns, contains the collection of sibling node keys of the specified content type, ordered by sort order; or an empty collection if the node or content type doesn't exist. |
Returns
| Type | Description |
|---|---|
| bool |
|