code_junkie

fluent nHibernate mapping

Nov 13th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. public class Permit
  2. {
  3. public int PermitId { get; set; }
  4. public char Discipline { get; set; }
  5. public PermitDetails PermitDetails { get; set; }
  6. }
  7.  
  8. public PermitDetails
  9. {
  10. public int PermitId { get; set; }
  11. }
  12.  
  13. public class GasPermitDetails : PermitDetails
  14. {
  15. ... permit details
  16. }
  17.  
  18. public class ElectricalPermitDetails : PermitDetails
  19. {
  20. ... permit details
  21. }
  22.  
  23. *tblPermit*
  24. PermitId, int
  25. Discipline, char
  26. .... some other columns
  27.  
  28. *tblGas*
  29. PermitId, int
  30. ....gasDetails
  31.  
  32. *tblElectrical*
  33. PermitId, int
  34. ....electrical details
  35.  
  36. +---------------+ +----------------------+
  37. | | 1 1 | |
  38. | tblPermit |<------->| tblGas |
  39. | | | (for gas discipline) |
  40. | | | |
  41. +---------------+ +----------------------+
  42. | | | |
  43. | {PK} PermitId | | {FK} PermitID | <- ForeignKey to tblPermit.PermitID
  44. | | | |
  45. +---------------+ +----------------------+
Add Comment
Please, Sign In to add comment