Hi I'm using TPH inheritance to establish similar configurable items. My TPH Model is:
public class baseConfigItem
{
public int ID {get; set;}
public string ExternalText {get; set;}
public string InternalText { get; set; }
public bool Active { get; set; }
public string Group { get; set; }
public int SortOrder { get; set; }
public statusDef status { get; set; }
public virtual ICollection<Order> Orders{get;set;}
public baseConfigItem()
{
this.Orders= new List<Order>();
}
}
public class DoorTypes:baseConfigItem{public DoorTypes():base(){}}
public class WindowType : baseConfigItem { public WindowType():base(){}}
public class WallType : baseConfigItem { public WallType():base(){}}
public class RoofType : baseConfigItem { public RoofType():base(){}}
public class RoofSize : baseConfigItem { public RoofSize():base(){}}
public class DoorSize : baseConfigItem { public DoorSize():base(){}}
public class GardenSize : baseConfigItem { public GardenSize():base(){}}
I then need to create many to many and 1, one to many/many to one relationship with the child entities with the order entities:
- Order has many WindowTypes
- Order has many WallTypes
- Order has many RoofTypes
- Order has one RoofSize
- Order has one DoorSize
- Order has one GardenSize
public class Order
{
public int ID {get; set;}
public virtual ICollection<WindowType> WindowTypes {get; set;}
public virtual ICollection<WallType> WallTypes {get; set;}
public virtual ICollection<RoofType> RoofTypes {get; set;}
public RoofSize RoofSize {get; set;}
public DoorSize DoorSize {get; set;}
public GardenSize GardenSize {get; set;}
}
However, this doesn't generate a many to many relationship for RoofTypes, WallTypes, etc... I had assumed that the public virtual ICollection Orders{get;set;} would be inherited. How would I be able to establish the above inherited classes with a many to many and one to many relationship with order ?