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 SinghRank #66 · 26.2K reputationPosted Nov 17, 2020, 11:27 PM EST
Marius VasileRank #785 · 2.9K reputationPosted Nov 18, 2020, 2:27 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Nov 18, 2020, 5:58 PM EST
Marius VasileRank #785 · 2.9K reputationPosted Nov 19, 2020, 1:19 AM EST
Marius VasileRank #785 · 2.9K reputationPosted Nov 19, 2020, 1:22 AM EST
Marius VasileRank #785 · 2.9K reputationPosted Nov 19, 2020, 6:51 AM EST