ComponentAsId does not find property that belongs to a parent class
Description
Environment
None
100% Done
is duplicated by
Activity
Show:
Alex Zaytsev September 8, 2014 at 11:31 AM
Close issues resolved in 3.3.3
Alex Zaytsev February 9, 2013 at 12:53 AM
Commited to 3.3.x 09e7b72444550df07d1aabf5bdfbe0b1b6973b35
Thomas Gaboriau April 4, 2012 at 9:07 AM
No, we have got the same problem with NH3.2.
Oskar Berggren April 3, 2012 at 4:09 PM
Does it work in 3.2?
Fixed
Details
Details
Assignee
Alex Zaytsev
Alex ZaytsevReporter
Thomas Gaboriau
Thomas GaboriauLabels
Components
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created March 28, 2012 at 9:30 AM
Updated September 8, 2014 at 11:31 AM
Resolved February 9, 2013 at 12:53 AM
Who's Looking?
e.g.
public class Key
{
public string GroupId { get; set; }
public string NameId { get; set; }
public override bool Equals( object obj )
{
Key key = obj as Key;
if ( key == null )
{
return false;
}
return ( key.GroupId == GroupId && key.NameId == NameId );
}
public override int GetHashCode()
{
return GroupId.GetHashCode() + NameId.GetHashCode();
}
}
public abstract class NotMappedParent
{
public virtual Key Id { get; set; }
}
public class Child : NotMappedParent
{
public virtual string Value { get; set; }
}
mapper.Class<Child>(ca =>
{
ca.ComponentAsId(s => s.Id, map =>
{
map.Property(key => key.GroupId);
map.Property(key => key.NameId);
});
});
Actual :
<id type="Int32" />
Expected :
<composite-id class="Key" name="Id">
<key-property name="GroupId" />
<key-property name="NameId" />
</composite-id>