I am using "Class Table Inheritance - Using joined subclasses" as described here: http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html
The following code is partly copied from there.
[ActiveRecord("entity"), JoinedBase]
public class Entity : ActiveRecordBase
{
...
private int id;
[PrimaryKey]
private int Id
{
get { return id; }
set { id = value; }
}
}
[ActiveRecord("entitycompany")]
public class CompanyEntity : Entity
{
private int comp_id;
[JoinedKey("comp_id")]
public int CompId
{
get { return comp_id; }
set { comp_id = value; }
}
....
}
Now when I have a CompanyEntity loaded and access the ComId property it is always 0, but the inherited Id Property contains the correct value.
Edit:
I Probably should add that our Entities are automatically generate and I do not want to touch the generator.
Edit2:
Ok, I realize that I have to touch the generator in order to make it work. But still why isn't Active Record setting the Comp_id?
Question:
How can I tell ActiveRecord to also set the value of the JoinedKey in the child class so that CompId == Id?