U4-10263 - Missing UDI + GUID friendly MediaService.GetByIds, ContentService.GetByIds

Created by Shannon Deminick 08 Aug 2017, 02:29:00 Updated by Claus Jensen 10 Aug 2017, 09:28:51

Tags: Unscheduled

Relates to: U4-10262

Subtask of: UAASSCRUM-964

We currently only support INT for these methods but we should support both GUID + UDI (UDI ones can be extension methods!)


Shannon Deminick 09 Aug 2017, 15:12:55

PR: https://github.com/umbraco/Umbraco-CMS/pull/2118

This adds Get, GetAll, Exists with GUID Id support for content/media repositories + services - this then easily allows us to add GetByIds for GUID + UDIs

The way this done is by creating a IReadRepository<Guid, IContent> and IReadRepository<Guid, IMedia> as inner repositories and because repositories are responsible for caching based on a key, this will do the Guid -> Entity caching for us. It's not perfectly pretty and that is because of the poorly designed inheritance structure of the interfaces (see TODO notes in PR about that) which means we simply leave a bunch of repository methods to throw NotImplemented (we do this in other parts of the service/repo layer too because of this same inheritance structure). Ideally we'd refactor this which isn't actually too difficult but it's a little late for this version to do that. I've added tests to verify that caching is done at both the GUID and the INT level which means we no longer require the IdKMap for the content/media services. The only caveat to this is that the amount of memory for entity caching will be larger because we can end up with duplicate caching for both INT and GUID but I don't see this as being a blocking issue currently. To fix that part would mean we'd have to somehow overhaul the 'key' used for the caching mechanism for repositories so the same object instance would be cached by multiple different keys.

This also fixes http://issues.umbraco.org/issue/U4-10262 and adds CreateContent, CreateMedia methods for dealing with GUIDs and UDIs

Shannon Deminick 10 Aug 2017, 02:05:44

To test:

  • All tests should pass
  • Have a look at the code
  • Test Deploy works

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.7.0

Sprint: Sprint 65

Story Points: 3