Search Results for

    Show / Hide Table of Contents
    View Source

    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 Source

    TryGetAncestorsKeys(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

    true if the child node exists in the structure; otherwise, false.

    View Source

    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

    true if the node and content type exist and ancestors were retrieved; otherwise, false.

    View Source

    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

    true if the child node exists in the structure; otherwise, false.

    View Source

    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

    true if the parent node exists in the structure; otherwise, false.

    View Source

    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

    true if the parent and content type exist and children were retrieved; otherwise, false.

    View Source

    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

    true if the parent node exists in the structure; otherwise, false.

    View Source

    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

    true if the parent and content type exist and descendants were retrieved; otherwise, false.

    View Source

    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

    true if the parent node exists in the structure; otherwise, false.

    View Source

    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 null if the node doesn't exist.

    Returns
    Type Description
    bool

    true if the node exists and its level was determined; otherwise, false.

    View Source

    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, null. The value will be null if the child is at root level.

    Returns
    Type Description
    bool

    true if the child node exists in the structure; otherwise, false.

    View Source

    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

    true if the operation succeeds; otherwise, false.

    View Source

    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

    true if the content type exists and root keys were retrieved; otherwise, false.

    View Source

    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

    true if the node exists in the structure; otherwise, false.

    View Source

    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

    true if the node and content type exist and siblings were retrieved; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX