The problem is I have 4 tables, Table 1, Table 2, Table 3 and Table 4. Table 1 has one-to-many relations with Table-2, Table 2 one-to-many to Table 3 and so on. all are similar on content, tables content below
- public class HazardsClass
- {
- [Key]
- public int IdHC { get; set; }
- public string HazClass { get; set; }
- public ICollection
HazardsDetails { get; set; } - }
- public class HazardsDetail
- {
- [Key]
- public int IdH { get; set; }
- public string HazDetail { get; set; }
- public int IdHC { get; set; }
- [ForeignKey("IdHC")]
- public HazardsClass HazardsClass { get; set; }
- public ICollection
HazardsPMClasses { get; set; } - }
- public class HazardsPMClass
- {
- [Key]
- public int IdPMC { get; set; }
- public string HazPMClass { get; set; }
- public int IdH { get; set; }
- [ForeignKey("IdH")]
- public HazardsDetail HazardsDetail { get; set; }
- public ICollection
HazardsPMDetails { get; set; } - }
- public class HazardsPMDetail
- {
- [Key]
- public int IdPM { get; set; }
- public string HazPMDetail { get; set; }
- public int IdPMC { get; set; }
- [ForeignKey("IdPMC")]
- public HazardsPMClass HazardsPMClass { get; set; }
- }
How do I do that?

Sachin SinghPosted Nov 18, 2020, 4:27 AM
Marius VasilePosted Nov 19, 2020, 11:51 AM
Marius VasilePosted Nov 19, 2020, 6:22 AM
Marius VasilePosted Nov 19, 2020, 6:19 AM
Sachin SinghPosted Nov 18, 2020, 10:58 PM
Marius VasilePosted Nov 18, 2020, 7:27 AM