Skip to content

Commit 8698fdc

Browse files
committed
Merge pull request #250 from chester89/issue57
Fix for #57 - ForeignKey.EndsWith messes up multiple one-to-many relationships
2 parents 6f293a2 + 72c2b01 commit 8698fdc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/FluentNHibernate/Visitors/RelationshipPairingVisitor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static CollectionMapping FindAlternative(IEnumerable<CollectionMapping> rs, Coll
182182
{
183183
var alternative = rs
184184
.Where(x => self_referenced_relation_does_not_point_to_itself(x, current))
185-
.Where(x => x.ContainingEntityType == current.ContainingEntityType)
185+
.Where(x => x.ContainingEntityType == current.ContainingEntityType &&
186+
x.ChildType == current.ChildType)
186187
.Select(x => GetLikeness(x, otherSide))
187188
.OrderBy(x => x.Differences)
188189
.FirstOrDefault();

0 commit comments

Comments
 (0)