I have a device class, computer class and a virtualdesktop class. Every computer is a device and every virtualdesktop is a computer. I want to add a property to my virtualdesktop that references another device of type computer indicating where the virtual device is hosted. I am using POCOs with Entity Framework 5.0 in a Code First environment. How should I add this property to my virtualdesktop class below ? Is this a self-referencing relationship ?
[Table("devices")]
public class device
{
public int DeviceId { get; set; }
public string Description { get; set; }
public string IPAddress { get; set; }
}
[Table("computers")]
public class computer : device
{
public string OperatingSystem { get; set; }
public string OS_LicenseKey { get; set; }
}
[Table("virtualdesktops")]
public class virtualdesktop : computer
{
//Should I do this
public Computer Computer {get; set;}
//Or should I do this
public int ComputerId {get; set;}
}