Class NearestAncestorOrSelfDynamicRootQueryStep
A query step that finds the nearest (closest) ancestor or self matching the specified document type criteria. This step traverses up the content tree from the origin and returns the first matching node.
Inheritance
Namespace: Umbraco.Cms.Core.DynamicRoot.QuerySteps
Assembly: Umbraco.Core.dll
Syntax
public class NearestAncestorOrSelfDynamicRootQueryStep : IDynamicRootQueryStep
Constructors
View SourceNearestAncestorOrSelfDynamicRootQueryStep(ICoreScopeProvider, IDynamicRootRepository)
Initializes a new instance of the NearestAncestorOrSelfDynamicRootQueryStep class.
Declaration
public NearestAncestorOrSelfDynamicRootQueryStep(ICoreScopeProvider scopeProvider, IDynamicRootRepository nodeFilterRepository)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | scopeProvider | The scope provider for database operations. |
| IDynamicRootRepository | nodeFilterRepository | The repository used to query for ancestors matching the filter criteria. |
Properties
View SourceSupportedDirectionAlias
Gets the direction alias that this query step supports (e.g., "NearestAncestorOrSelf", "FurthestDescendantOrSelf").
Declaration
public virtual string SupportedDirectionAlias { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceExecuteAsync(ICollection<Guid>, DynamicRootQueryStep)
Executes the query step on the specified origin content items.
Declaration
public Task<Attempt<ICollection<Guid>>> ExecuteAsync(ICollection<Guid> origins, DynamicRootQueryStep filter)
Parameters
| Type | Name | Description |
|---|---|---|
| ICollection<Guid> | origins | The collection of content keys to use as starting points for this query step. |
| DynamicRootQueryStep | filter | The query step configuration containing the alias and document type filter criteria. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ICollection<Guid>>> | A task representing the asynchronous operation, containing an Attempt<TResult> with the filtered content keys. Returns a failed attempt if this query step does not support the specified alias. |