override PerformGetAll (#17822)

This commit is contained in:
Nikolaj Geisle
2024-12-16 13:35:02 +01:00
committed by GitHub
parent 32d0cb477e
commit 77b6e6e6d9

View File

@@ -223,6 +223,19 @@ internal class DictionaryRepository : EntityRepositoryBase<int, IDictionaryItem>
return new SingleItemsOnlyRepositoryCachePolicy<IDictionaryItem, Guid>(GlobalIsolatedCache, ScopeAccessor,
options);
}
protected override IEnumerable<IDictionaryItem> PerformGetAll(params Guid[]? ids)
{
Sql<ISqlContext> sql = GetBaseQuery(false).Where<DictionaryDto>(x => x.PrimaryKey > 0);
if (ids?.Any() ?? false)
{
sql.WhereIn<DictionaryDto>(x => x.UniqueId, ids);
}
return Database
.FetchOneToMany<DictionaryDto>(x => x.LanguageTextDtos, sql)
.Select(ConvertToEntity);
}
}
private class DictionaryByKeyRepository : SimpleGetRepository<string, IDictionaryItem, DictionaryDto>
@@ -266,6 +279,19 @@ internal class DictionaryRepository : EntityRepositoryBase<int, IDictionaryItem>
return new SingleItemsOnlyRepositoryCachePolicy<IDictionaryItem, string>(GlobalIsolatedCache, ScopeAccessor,
options);
}
protected override IEnumerable<IDictionaryItem> PerformGetAll(params string[]? ids)
{
Sql<ISqlContext> sql = GetBaseQuery(false).Where<DictionaryDto>(x => x.PrimaryKey > 0);
if (ids?.Any() ?? false)
{
sql.WhereIn<DictionaryDto>(x => x.Key, ids);
}
return Database
.FetchOneToMany<DictionaryDto>(x => x.LanguageTextDtos, sql)
.Select(ConvertToEntity);
}
}
protected override IEnumerable<IDictionaryItem> PerformGetAll(params int[]? ids)