Conversation
ronaldbarendse
approved these changes
Sep 5, 2025
src/Umbraco.Infrastructure/Persistence/Relations/ContentRelationsUpdate.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Persistence/Relations/ContentRelationsUpdate.cs
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Ronald Barendse <ronald@barend.se>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the persistence of relations from being handled directly in repositories to using notification handlers, improving the architecture and supporting Deploy operations optimization.
Key changes:
- Removes
PersistRelationscalls from repository persistence methods - Creates a new
ContentRelationsUpdatenotification handler to manage relation persistence - Registers the notification handler for content saved/published events
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| MemberRepository.cs | Removes PersistRelations calls from new and updated item persistence methods |
| MediaRepository.cs | Removes PersistRelations calls from new and updated item persistence methods |
| DocumentRepository.cs | Removes PersistRelations calls from new and updated item persistence methods |
| ContentRepositoryBase.cs | Marks PersistRelations method as obsolete and converts to no-op with warning log |
| ContentRelationsUpdate.cs | New notification handler implementing relation persistence logic for all content types |
| UmbracoBuilder.CoreServices.cs | Registers the new notification handler for content saved/published events |
src/Umbraco.Infrastructure/Persistence/Relations/ContentRelationsUpdate.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentRepositoryBase.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Migaroez
approved these changes
Sep 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
See #20079 (review) for the background to raising this PR, which relate to optimising and making more reliable save operations to support Deploy operations.
Also #20094.
I've moved the persistence of relations from the repositories into a notification handler.
In testing I can see it working as it did before.
Referencing some discussion from when this was first implemented around whether this should be carried out in an event (at the time, as it was Umbraco 8), or in the repository itself:
https://github.com/umbraco/Umbraco-CMS/pull/6843/files#r338926734
Testing
Via a database query, find the references for a given parent item - e.g. a document, that has pickers for documents, media or members; or any other property editor that holds references to other nodes:
Experiment with adding and removing related items, saving and publishing, and verifying that the related records are as expected.