Make PersistRelations a public method #10552
patrickdemooij9
started this conversation in
Features and ideas
Replies: 1 comment
-
I think this makes sense and your use case is also a valid one, although it should then be exposed in the service layer (not the repository layer). Looking at the code, it currently deletes all relations and then inserts them again, which is probably not something you want to do for all your unchanged content nodes (this will also unnecessarily defragment the database indexes BTW). This is currently not a major problem, as it's only executed for new or updated content and doesn't require fetching the existing relations, but we might want to look into that as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Current the method PersistRelations is a protected method:
Umbraco-CMS/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs
Line 964 in 40dbfa7
The PersistRelations function is now called whenever something updates or gets created. There is currently no way to rebuild the relations for multiple items. There might be a case where you are using a custom property picker that hasn't implemented the relations logic yet. However, if that logic does get implemented later on, you'll have to save every content item on your website again to make sure that those relations exists.
I've currently fixed this on my own website by copy pasting the PersistRelations logic in a different class, but it would be much easier if that was public. That way, people could also start writing rebuild relations logic as a backoffice button. Maybe we could even extend the Published Status dashboard with a Relations rebuild button.
Beta Was this translation helpful? Give feedback.
All reactions