How to map inheritance with property returned other inheritance?
- by dario-g
Hi
I have abstract class Vehicle and two classes that derive from: Car and ForkLift.
public abstract class Vehicle
{
public EngineBase Engine { get; set; }
}
public class Car : Vehicle
{
public GasEngine Engine { get; set; }
}
public class ForkLift : Vehicle
{
public ElectricEngine Engine { get; set; }
}
and Engine clasess:
public abstract class Engine
{
}
public class GasEngine : Engine
{
}
public class ElectricEngine : Engine
{
}
Engines are mapped with "table per class hierarchy". With Vehicles I want to use the same pattern.
How to map Engine class and derived with that Engine property?