Use ToArray instead of ToList

(cherry picked from commit f99378c5d3)
This commit is contained in:
CyberReiter
2022-10-12 07:51:43 +02:00
committed by Sebastiaan Janssen
parent c0d5b544f5
commit d46d5aac0d
2 changed files with 61 additions and 4 deletions

View File

@@ -486,7 +486,7 @@ WHERE cmsContentNu.nodeId IN (
Guid mediaObjectType = Constants.ObjectTypes.Media;
// remove all - if anything fails the transaction will rollback
if (contentTypeIds == null || contentTypeIds.Count == 0)
if (contentTypeIds is null || contentTypeIds.Count == 0)
{
// must support SQL-CE
Database.Execute(
@@ -513,7 +513,7 @@ WHERE cmsContentNu.nodeId IN (
// insert back - if anything fails the transaction will rollback
IQuery<IMedia> query = SqlContext.Query<IMedia>();
if (contentTypeIds != null && contentTypeIds.Count > 0)
if (contentTypeIds is not null && contentTypeIds.Count > 0)
{
query = query.WhereIn(x => x.ContentTypeId, contentTypeIds); // assume number of ctypes won't blow IN(...)
}
@@ -526,9 +526,9 @@ WHERE cmsContentNu.nodeId IN (
// the tree is locked, counting and comparing to total is safe
IEnumerable<IMedia> descendants =
_mediaRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path"));
var items = descendants.Select(m => GetDto(m, false, serializer)).ToList();
var items = descendants.Select(m => GetDto(m, false, serializer)).ToArray();
Database.BulkInsertRecords(items);
processed += items.Count;
processed += items.Length;
}
while (processed < total);
}