I'm trying to create Class Table Inheritance as in ( http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html )
So let's say I have 2 classes:
[ActiveRecord("entity"), JoinedBase]
public class Entity : ActiveRecordBase
{
private int id;
private string name;
private string type;
...and properties
}
[ActiveRecord("entitycompany")]
public class CompanyEntity : Entity
{
private byte company_type;
private int comp_id;
[JoinedKey("comp_id")]
public int CompId
{
get { return comp_id; }
set { comp_id = value; }
}
}
It seems to be ok, all tests are fine. One thing I see in profiler and it drives me mad is that if Entity is used (it's a property) in some other class (let's call it World), then fetching World results in left outer join on both Entity and CompanyEntity. I would expect it to be just a join on Entity!
Can anyone help me with that and explain why is it happening?