Mapping OneToOne doesn't work for inherited members

Description

When mapping property by OneToOne to derived class, PropertyReference method of IOneToOneMapper throws exception:

Expected a member of NHibernate.Test.NHSpecificTest.NH1234.PersonDetail found the member NHibernate.Test.NHSpecificTest.NH1234.Person Person of NHibernate.Test.NHSpecificTest.NH1234.PersonDetailBase

Implementation of PropertyReference in class OneToOneMapper uses this condition,

if (_member != null && propertyInTheOtherSide.DeclaringType != _member.GetPropertyOrFieldType())

which doesn't work for members from base class mapped in derived classes.

Similar condititon is used in OneToManyMapper in method Class and I think that provides better solution and sloves situation that I described:

if (!collectionElementType.IsAssignableFrom(entityType))

Environment

None

Activity

Show:
Alex Zaytsev
October 2, 2012, 4:08 PM

Thanks, fix commited to master 9d339f646296ade73c1b5041db3bca6fbde5188a

Oskar Berggren
October 20, 2012, 4:13 PM

Definitely not "critical".

Alex Zaytsev
May 13, 2013, 1:53 PM

Port-back to 3.3.x as ad35d6bc6ab617d8e8bf72e00a58023120bdc2aa

Fixed

Assignee

Alex Zaytsev

Reporter

Pavel Kocich

Labels

Components

Fix versions

Affects versions

Priority

Major
Configure