Skip to content

Commit bdd7327

Browse files
Ignitionchester89
authored andcommitted
Fix for PairOneToManys
1 parent f8c9212 commit bdd7327

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/FluentNHibernate/Visitors/RelationshipPairingVisitor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ static void PairOneToManys(IEnumerable<CollectionMapping> collections, IEnumerab
4949
foreach (var collection in orderedCollections)
5050
{
5151
var type = collection.ContainingEntityType;
52-
var reference = orderedRefs.FirstOrDefault(x => x.OtherSide == null && x.Class.GetUnderlyingSystemType() == type);
52+
var childType = collection.ChildType;
53+
var reference = orderedRefs
54+
.FirstOrDefault(x =>
55+
x.OtherSide == null &&
56+
x.Class.GetUnderlyingSystemType() == type &&
57+
x.ContainingEntityType == childType);
5358

5459
if (reference == null) continue;
5560

0 commit comments

Comments
 (0)