From 77b6e6e6d959d2b00c45fb8ceffd623778b51c39 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:35:02 +0100 Subject: [PATCH] override PerformGetAll (#17822) --- .../Implement/DictionaryRepository.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs index a93ae543a0..99d32f373d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs @@ -223,6 +223,19 @@ internal class DictionaryRepository : EntityRepositoryBase return new SingleItemsOnlyRepositoryCachePolicy(GlobalIsolatedCache, ScopeAccessor, options); } + + protected override IEnumerable PerformGetAll(params Guid[]? ids) + { + Sql sql = GetBaseQuery(false).Where(x => x.PrimaryKey > 0); + if (ids?.Any() ?? false) + { + sql.WhereIn(x => x.UniqueId, ids); + } + + return Database + .FetchOneToMany(x => x.LanguageTextDtos, sql) + .Select(ConvertToEntity); + } } private class DictionaryByKeyRepository : SimpleGetRepository @@ -266,6 +279,19 @@ internal class DictionaryRepository : EntityRepositoryBase return new SingleItemsOnlyRepositoryCachePolicy(GlobalIsolatedCache, ScopeAccessor, options); } + + protected override IEnumerable PerformGetAll(params string[]? ids) + { + Sql sql = GetBaseQuery(false).Where(x => x.PrimaryKey > 0); + if (ids?.Any() ?? false) + { + sql.WhereIn(x => x.Key, ids); + } + + return Database + .FetchOneToMany(x => x.LanguageTextDtos, sql) + .Select(ConvertToEntity); + } } protected override IEnumerable PerformGetAll(params int[]? ids)