When using ComponentAsId, mappings to Id fields that are from a base class (virtual or not) do not work.

Description

See http://stackoverflow.com/q/14254578/25182 for a detailed description of the problem.

The root cause is that the call to Expression.Body.Member (TypeExtensions.cs:72) returns the declaring type, not the child type. See http://stackoverflow.com/a/9466608/25182 for an explanation.

Later, when CompileMappingFor, the child type is used (because of BindingFlags.FlattenHierarchy), but the properties don't match up because their declared class is different.

So, possible solutions are to initially resolve the MemberInfo with the child type, or when searching the Poids list to check for child inheritance as well.

Environment

None

Activity

Show:
Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created February 8, 2013 at 6:18 PM
Updated February 8, 2013 at 11:26 PM
Resolved February 8, 2013 at 11:26 PM
Who's Looking?