I'm in the process of adapting Fluent NHibernate to an existing legacy application and trying to determine how to use ClassMap and SubclassMap for the entity hierarchy shown.
public class BaseObject
{
public string CommonDbCol1 { get; set; }
public string CommonDbCol2 { get; set; }
}
public class Entity1 : BaseObject
{
public int Entity1Id { get; set; }
}
public class Entity2 : BaseObject
{
public int Entity2Id { get; set; }
}
The identity columns for Entity1 and Entity2 are uniquely identified for each table. BaseObject contains columns that are common to all of our objects. I do not use AutoMapping, and thought I could use ClassMap in BaseObject and then use SubclassMap for each Entity, like this:
public class Entity1Map : SubclassMap<Entity1>
{
public Entity1Map()
{
Id(x => x.Entity1Id);
}
}
The problem is that Id () is not defined for SubclassMap. So, how can I indicate in each Entity1Map, Entity2Map, ... (we have 100+ entity classes, all inheriting from BaseObject), what is an object identifier?
Thanks in advance for your understanding!