diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs index 354083dfa8..0821232826 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/AccessDto.cs @@ -37,5 +37,5 @@ internal class AccessDto [ResultColumn] [Reference(ReferenceType.Many, ReferenceMemberName = "AccessId")] - public List Rules { get; set; } = null!; + public List Rules { get; set; } = new(); } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index 3e92a4ae7f..59aa92bb82 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -1385,10 +1385,15 @@ AND umbracoNode.id <> @id", } // Now bulk update the umbracoDocument table - foreach (IGrouping> editValue in editedDocument.GroupBy(x => x.Value)) + // we need to do this in batches as the WhereIn Npoco method translates to all the nodeIds being passed in as parameters when using the SqlClient provider + // this results in to many parameters (>2100) being passed to the client when there are a lot of documents being normalized + foreach (IGrouping> groupByValue in editedDocument.GroupBy(x => x.Value)) { - Database.Execute(Sql().Update(u => u.Set(x => x.Edited, editValue.Key)) - .WhereIn(x => x.NodeId, editValue.Select(x => x.Key))); + foreach (IEnumerable> batch in groupByValue.InGroupsOf(2000)) + { + Database.Execute(Sql().Update(u => u.Set(x => x.Edited, groupByValue.Key)) + .WhereIn(x => x.NodeId, batch.Select(x => x.Key))); + } } }