Skip to content

Commit

Permalink
Fix BeforeAssemble call for Map and IdentifierBag (nhibernate#3380)
Browse files Browse the repository at this point in the history
Fixup for nhibernate#3365
  • Loading branch information
bahusoid authored Jul 25, 2023
1 parent 13565fb commit c9d0a95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override async Task InitializeFromCacheAsync(ICollectionPersister persist

var identifierType = persister.IdentifierType;
var elementType = persister.ElementType;
for (int i = 0; i < size; i++)
for (int i = 0; i < size; i += 2)
{
await (identifierType.BeforeAssembleAsync(array[i], Session, cancellationToken)).ConfigureAwait(false);
await (elementType.BeforeAssembleAsync(array[i + 1], Session, cancellationToken)).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public override async Task InitializeFromCacheAsync(ICollectionPersister persist
object[] array = (object[])disassembled;
int size = array.Length;
BeforeInitialize(persister, size);

var indexType = persister.IndexType;
var elementType = persister.ElementType;
for (int i = 0; i < size; i++)
for (int i = 0; i < size; i += 2)
{
await (indexType.BeforeAssembleAsync(array[i], Session, cancellationToken)).ConfigureAwait(false);
await (elementType.BeforeAssembleAsync(array[i + 1], Session, cancellationToken)).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override void InitializeFromCache(ICollectionPersister persister, object

var identifierType = persister.IdentifierType;
var elementType = persister.ElementType;
for (int i = 0; i < size; i++)
for (int i = 0; i < size; i += 2)
{
identifierType.BeforeAssemble(array[i], Session);
elementType.BeforeAssemble(array[i + 1], Session);
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate/Collection/Generic/PersistentGenericMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ public override void InitializeFromCache(ICollectionPersister persister, object
object[] array = (object[])disassembled;
int size = array.Length;
BeforeInitialize(persister, size);

var indexType = persister.IndexType;
var elementType = persister.ElementType;
for (int i = 0; i < size; i++)
for (int i = 0; i < size; i += 2)
{
indexType.BeforeAssemble(array[i], Session);
elementType.BeforeAssemble(array[i + 1], Session);
Expand Down

0 comments on commit c9d0a95

Please sign in to comment.