Can't specify Key for JoinedSubclass with NHibernate.Mapping.Attributes

Description

I tried to use NHibernate.Mapping.Attributes.JoinedSubclass, but a joined-subclass requires a key child element, and when I specify the key as shown:

[NHibernate.Mapping.Attributes.JoinedSubclass(0,ExtendsType=typeof(Fund))]
[NHibernate.Mapping.Attributes.Key(1,Column="FUND_ROW_ID")]
public class PlanFund:Fund

I recieve this error:

error CS0592: Attribute 'NHibernate.Mapping.Attributes.Key' is not valid on this declaration type. It is valid on 'property, field' declarations only.

Environment

None

Activity

Show:

Jay Tuley December 21, 2005 at 8:50 AM

Key has nothing to do with RandomProperty, which makes this a kludge (and user interface kludges are issues). Maybe this isn't fixable or it's not worth fixing at this moment, but it really is an issue.

Pierre Henri Kuaté December 21, 2005 at 3:49 AM

I don't see this as an "issue"; it is the way NHMA works...

Jay Tuley December 14, 2005 at 1:59 PM

I figured out a work around by moving the key attribute to the first property

[NHibernate.Mapping.Attributes.Key(0,Column="FUND_ROW_ID")]
[NHibernate.Property(1)]
public int RandomProperty

But that's kind of ugly and weird, but it produces the right xml so this could be a less priority bug.

Not an Issue

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created December 14, 2005 at 8:55 AM
Updated July 9, 2008 at 11:54 PM
Resolved December 21, 2005 at 3:49 AM
Who's Looking?