Skip to content

Commit 5596176

Browse files
Fix component equality failure
Minimal fix for NH-3480
1 parent df24b5d commit 5596176

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/NHibernate.Test/Async/NHSpecificTest/NH3480/Fixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ public async Task TestAsync()
6868
var entity = await (result.SingleAsync());
6969

7070
await (NHibernateUtil.InitializeAsync(entity.Children));
71+
Assert.That(entity.Children, Has.Count.GreaterThan(0));
7172
}
7273
}
7374
}
7475
}
75-
}
76+
}

src/NHibernate.Test/NHSpecificTest/NH3480/Fixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public void Test()
5757
var entity = result.Single();
5858

5959
NHibernateUtil.Initialize(entity.Children);
60+
Assert.That(entity.Children, Has.Count.GreaterThan(0));
6061
}
6162
}
6263
}
6364
}
64-
}
65+
}

src/NHibernate/Type/ComponentType.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@ public override bool IsEqual(object x, object y, ISessionFactoryImplementor fact
600600
{
601601
return false;
602602
}
603+
604+
var componentType = EntityMode == EntityMode.Poco ? ComponentTuplizer.MappedClass : typeof(IDictionary);
605+
if (!componentType.IsInstanceOfType(x) || !componentType.IsInstanceOfType(y))
606+
return false;
607+
603608
object[] xvalues = GetPropertyValues(x);
604609
object[] yvalues = GetPropertyValues(y);
605610
for (int i = 0; i < propertySpan; i++)

0 commit comments

Comments
 (0)