In domain driven design, I have the following situation.
I have a Vehicle model. The vehicle can be of type HatchbackCar, SedanCar, Truck etc.
The VehicleType is stored in a database lookup table.
Question is:
How do I model the Domain?
Do I Model it like the following:
public class Vehicle
{
public int VehicleId{Get;Set;}
**public int VehicleTypeId { get; set; }**
public string MakeCode { get; set; }
public string ModelCode { get; set; }
public int Power { get; set; }
public int Weight { get; set; }
public int PowerToWeight { get { return Power/Weight*100; } }
}
OR
public class Vehicle
{
public int VehicleId{Get;Set;}
**public VehicleType VehicleType { get; set; }**
public string MakeCode { get; set; }
public string ModelCode { get; set; }
public int Power { get; set; }
public int Weight { get; set; }
public int PowerToWeight { get { return Power/Weight*100; } }
}
AND
public class VehicleType
{
public int VehicleTypeId{Get;Set;}
public string Description{Get;Set;}
}
If I use the 2nd way, at what stage do I populate the VehicleType model.
Thanks.