I have gone through the tutorial, and have implemented attributes in my code. In one place, it struck me odd that I had to add attributes to the properties of the class, rather than to the class itself. For example:
Code:
[NHibernate.Mapping.Attributes.JoinedSubclass(NameType=typeof(Subclass), ExtendsType=typeof(SomeClass), Table="MyTable", Lazy=true)]
public class Subclass: SomeClass
{
[NHibernate.Mapping.Attributes.Key(-1, Column="key" )]
private string prop;
[Nhibernate.Mapping.Attributes.Property]
public string Prop
{
get { return prop; }
set { prop = value; }
}
}
It seems like Key should be specified right after JoinedSubclass, rather than inside the class. Also, I was wondering why the JoinedSubclass does not get emitted into the XML as a child of the appropriate class element, but rather as a sibbling, with the (as a result) required "extends" attribute.
Thanks for the neat tools!
Gene