Class TrackedReferencesService
Provides services for tracking and querying references between entities in Umbraco.
Inheritance
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class TrackedReferencesService : ITrackedReferencesService
Remarks
This service is used to find relationships and dependencies between content, media, and other entities. It helps determine which items reference other items, which is useful for operations like deletion checks.
Constructors
View SourceTrackedReferencesService(ITrackedReferencesRepository, ICoreScopeProvider, IEntityService)
Initializes a new instance of the TrackedReferencesService class.
Declaration
public TrackedReferencesService(ITrackedReferencesRepository trackedReferencesRepository, ICoreScopeProvider scopeProvider, IEntityService entityService)
Parameters
| Type | Name | Description |
|---|---|---|
| ITrackedReferencesRepository | trackedReferencesRepository | The repository for accessing tracked reference data. |
| ICoreScopeProvider | scopeProvider | The scope provider for database operations. |
| IEntityService | entityService | The entity service for retrieving entity information. |
Methods
View SourceGetPagedDescendantsInReferencesAsync(Guid, long, long, bool)
Gets a paged result of the descending items that have any references, given a parent id.
Declaration
[Obsolete("Use GetPagedDescendantsInReferencesAsync which returns an Attempt with operation status. Scheduled for removal in Umbraco 19.")]
public Task<PagedModel<RelationItemModel>> GetPagedDescendantsInReferencesAsync(Guid parentKey, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent to retrieve descendants for. |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<RelationItemModel>> | A paged result of RelationItemModel objects. |
GetPagedDescendantsInReferencesAsync(Guid, UmbracoObjectTypes, long, long, bool)
Gets a paged result of the descending items that have any references, given a parent id.
Declaration
public Task<Attempt<PagedModel<RelationItemModel>, GetReferencesOperationStatus>> GetPagedDescendantsInReferencesAsync(Guid parentKey, UmbracoObjectTypes objectType, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentKey | The unique identifier of the parent to retrieve descendants for. |
| UmbracoObjectTypes | objectType | The Umbraco object type of the parent. |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<RelationItemModel>, GetReferencesOperationStatus>> | An Attempt wrapping a paged result of RelationItemModel objects. |
GetPagedItemsWithRelationsAsync(ISet<Guid>, long, long, bool)
Gets a paged result of items used in any kind of relation from selected integer ids.
Declaration
public Task<PagedModel<RelationItemModel>> GetPagedItemsWithRelationsAsync(ISet<Guid> keys, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| ISet<Guid> | keys | The identifiers of the entities to check for relations. |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<RelationItemModel>> | A paged result of RelationItemModel objects. |
GetPagedKeysWithDependentReferencesAsync(ISet<Guid>, Guid, long, long)
Gets a paged result of entity keys that have dependent references.
Declaration
public Task<PagedModel<Guid>> GetPagedKeysWithDependentReferencesAsync(ISet<Guid> keys, Guid objectTypeId, long skip, long take)
Parameters
| Type | Name | Description |
|---|---|---|
| ISet<Guid> | keys | The set of entity keys to check for dependent references. |
| Guid | objectTypeId | |
| long | skip | The amount of items to skip. |
| long | take | The amount of items to take. |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<Guid>> | A paged result of entity keys that have dependent references. |
GetPagedRelationsForItemAsync(Guid, long, long, bool)
Gets a paged result of items which are in relation with the current item. Basically, shows the items which depend on the current item.
Declaration
[Obsolete("Use the GetPagedRelationsForItemAsync overload which returns an Attempt with operation status. Scheduled for removal in Umbraco 19.")]
public Task<PagedModel<RelationItemModel>> GetPagedRelationsForItemAsync(Guid key, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The identifier of the entity to retrieve relations for. |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<RelationItemModel>> | A paged result of RelationItemModel objects. |
GetPagedRelationsForItemAsync(Guid, UmbracoObjectTypes, long, long, bool)
Gets a paged result of items which are in relation with the current item. Basically, shows the items which depend on the current item.
Declaration
public Task<Attempt<PagedModel<RelationItemModel>, GetReferencesOperationStatus>> GetPagedRelationsForItemAsync(Guid key, UmbracoObjectTypes objectType, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The identifier of the entity to retrieve relations for. |
| UmbracoObjectTypes | objectType | The Umbraco object type of the parent. |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<RelationItemModel>, GetReferencesOperationStatus>> | A paged result of RelationItemModel objects. |
GetPagedRelationsForRecycleBinAsync(UmbracoObjectTypes, long, long, bool)
Gets a paged result of items which are in relation with an item in the recycle bin.
Declaration
public Task<PagedModel<RelationItemModel>> GetPagedRelationsForRecycleBinAsync(UmbracoObjectTypes objectType, long skip, long take, bool filterMustBeIsDependency)
Parameters
| Type | Name | Description |
|---|---|---|
| UmbracoObjectTypes | objectType | The Umbraco object type that has recycle bin support (currently Document or Media). |
| long | skip | The amount of items to skip |
| long | take | The amount of items to take. |
| bool | filterMustBeIsDependency | A boolean indicating whether to filter only the RelationTypes which are dependencies (isDependency field is set to true). |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<RelationItemModel>> | A paged result of RelationItemModel objects. |