Skip to content

Commit 77b6e6e

Browse files
authored
override PerformGetAll (#17822)
1 parent 32d0cb4 commit 77b6e6e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,19 @@ protected override IRepositoryCachePolicy<IDictionaryItem, Guid> CreateCachePoli
223223
return new SingleItemsOnlyRepositoryCachePolicy<IDictionaryItem, Guid>(GlobalIsolatedCache, ScopeAccessor,
224224
options);
225225
}
226+
227+
protected override IEnumerable<IDictionaryItem> PerformGetAll(params Guid[]? ids)
228+
{
229+
Sql<ISqlContext> sql = GetBaseQuery(false).Where<DictionaryDto>(x => x.PrimaryKey > 0);
230+
if (ids?.Any() ?? false)
231+
{
232+
sql.WhereIn<DictionaryDto>(x => x.UniqueId, ids);
233+
}
234+
235+
return Database
236+
.FetchOneToMany<DictionaryDto>(x => x.LanguageTextDtos, sql)
237+
.Select(ConvertToEntity);
238+
}
226239
}
227240

228241
private class DictionaryByKeyRepository : SimpleGetRepository<string, IDictionaryItem, DictionaryDto>
@@ -266,6 +279,19 @@ protected override IRepositoryCachePolicy<IDictionaryItem, string> CreateCachePo
266279
return new SingleItemsOnlyRepositoryCachePolicy<IDictionaryItem, string>(GlobalIsolatedCache, ScopeAccessor,
267280
options);
268281
}
282+
283+
protected override IEnumerable<IDictionaryItem> PerformGetAll(params string[]? ids)
284+
{
285+
Sql<ISqlContext> sql = GetBaseQuery(false).Where<DictionaryDto>(x => x.PrimaryKey > 0);
286+
if (ids?.Any() ?? false)
287+
{
288+
sql.WhereIn<DictionaryDto>(x => x.Key, ids);
289+
}
290+
291+
return Database
292+
.FetchOneToMany<DictionaryDto>(x => x.LanguageTextDtos, sql)
293+
.Select(ConvertToEntity);
294+
}
269295
}
270296

271297
protected override IEnumerable<IDictionaryItem> PerformGetAll(params int[]? ids)

0 commit comments

Comments
 (0)