I am working on a legacy system and have introduced fluent nHibernate but have one last mapping that I can not seem to get working.
Code:
public class Permit
{
public int PermitId { get; set; }
public char Discipline { get; set; }
public PermitDetails PermitDetails { get; set; }
}
public PermitDetails
{
public int PermitId { get; set; }
}
public class GasPermitDetails : PermitDetails
{
... permit details
}
public class ElectricalPermitDetails : PermitDetails
{
... permit details
}
Schema:
*tblPermit*
PermitId, int
Discipline, char
.... some other columns
*tblGas*
PermitId, int
....gasDetails
*tblElectrical*
PermitId, int
....electrical details
(if tblPermit.Discipline is "G" we need to get the data out of tblGas. if tblPermit.Discipline is "E" we need to get the data out of tblElectrical). I have messing around trying to get this figured out but have not had any luck so far.