Class RelateOnTrashNotificationHandler
Handles notifications triggered when content is moved to the recycle bin ("trash") in Umbraco, and manages the relationships between the trashed content and other entities accordingly.
Inheritance
Namespace: Umbraco.Cms.Core.Events
Assembly: Umbraco.Infrastructure.dll
Syntax
public sealed class RelateOnTrashNotificationHandler : INotificationHandler<ContentMovedNotification>, INotificationHandler<ContentMovedToRecycleBinNotification>, INotificationAsyncHandler<ContentMovedToRecycleBinNotification>, INotificationHandler<MediaMovedNotification>, INotificationHandler<MediaMovedToRecycleBinNotification>, INotificationAsyncHandler<MediaMovedToRecycleBinNotification>, INotificationHandler
Constructors
View SourceRelateOnTrashNotificationHandler(IRelationService, IEntityService, ILocalizedTextService, IAuditService, IScopeProvider, IBackOfficeSecurityAccessor)
Initializes a new instance of the RelateOnTrashNotificationHandler class. Handles the creation of relations when entities are moved to the recycle bin (trashed).
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled for removal in Umbraco 19.")]
public RelateOnTrashNotificationHandler(IRelationService relationService, IEntityService entityService, ILocalizedTextService textService, IAuditService auditService, IScopeProvider scopeProvider, IBackOfficeSecurityAccessor backOfficeSecurityAccessor)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationService | relationService | Service used to manage relations between entities. |
| IEntityService | entityService | Service for accessing and managing entities. |
| ILocalizedTextService | textService | Service for retrieving localized text strings. |
| IAuditService | auditService | Service for logging audit events. |
| IScopeProvider | scopeProvider | Provides scope management for database operations. |
| IBackOfficeSecurityAccessor | backOfficeSecurityAccessor | Accessor for back office security context. |
RelateOnTrashNotificationHandler(IRelationService, IEntityService, ILocalizedTextService, IAuditService, IScopeProvider, IBackOfficeSecurityAccessor, IUserIdKeyResolver)
Initializes a new instance of the RelateOnTrashNotificationHandler class.
Declaration
public RelateOnTrashNotificationHandler(IRelationService relationService, IEntityService entityService, ILocalizedTextService textService, IAuditService auditService, IScopeProvider scopeProvider, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, IUserIdKeyResolver userIdKeyResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationService | relationService | Service used to manage relations between entities. |
| IEntityService | entityService | Service used to manage entities within Umbraco. |
| ILocalizedTextService | textService | Service for retrieving localized text resources. |
| IAuditService | auditService | Service for logging audit events. |
| IScopeProvider | scopeProvider | Provider for managing database scopes. |
| IBackOfficeSecurityAccessor | backOfficeSecurityAccessor | Accessor for back office security context. |
| IUserIdKeyResolver | userIdKeyResolver | Resolves user ID keys for operations. |
Methods
View SourceHandle(ContentMovedNotification)
Handles a ContentMovedNotification by removing parent-child relations for content items that have been moved to the recycle bin.
Declaration
public void Handle(ContentMovedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentMovedNotification | notification | The notification containing information about the moved content items. |
Handle(ContentMovedToRecycleBinNotification)
Handles a notification when content is moved to the recycle bin by removing any parent-child relations of type 'Relate Parent Document On Delete' for the affected content items.
Declaration
[Obsolete("Use the INotificationAsyncHandler.HandleAsync implementation instead. Scheduled for removal in Umbraco 19.")]
public void Handle(ContentMovedToRecycleBinNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentMovedToRecycleBinNotification | notification | The notification containing details about the content items that have been moved to the recycle bin. |
Handle(MediaMovedNotification)
Handles a ContentMovedNotification by removing parent-child relations for content items that have been moved to the recycle bin.
Declaration
public void Handle(MediaMovedNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaMovedNotification | notification | The notification containing information about the moved content items. |
Handle(MediaMovedToRecycleBinNotification)
Handles a MediaMovedToRecycleBinNotification by removing relations when media is moved to the recycle bin.
Declaration
[Obsolete("Use the INotificationAsyncHandler.HandleAsync implementation instead. Scheduled for removal in Umbraco 19.")]
public void Handle(MediaMovedToRecycleBinNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaMovedToRecycleBinNotification | notification | The notification containing information about the media items that were moved to the recycle bin. |
HandleAsync(ContentMovedToRecycleBinNotification, CancellationToken)
Handles a notification.
Declaration
public Task HandleAsync(ContentMovedToRecycleBinNotification notification, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentMovedToRecycleBinNotification | notification | The notification. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
HandleAsync(MediaMovedToRecycleBinNotification, CancellationToken)
Handles a notification.
Declaration
public Task HandleAsync(MediaMovedToRecycleBinNotification notification, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaMovedToRecycleBinNotification | notification | The notification. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing the asynchronous operation. |