Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. [Table("User")]
  2. class User{
  3. [Key]
  4. public int idUser;
  5. public int idComputer; //ForeignKey
  6. }
  7.  
  8. [Table("Computer")]
  9. class Computer{
  10. [Key]
  11. public int idComputer;
  12. }
  13.  
  14. public class User
  15. {
  16. public User()
  17. {
  18. }
  19.  
  20. public int idUser; { get; set; }
  21. [Required]
  22. public string UserName { get; set; }
  23.  
  24.  
  25. public virtual Computer Computer{ get; set; }
  26.  
  27. }
  28.  
  29.  
  30. public class Computer
  31. {
  32. public Computer()
  33. {
  34. }
  35. [Key, ForeignKey("User")]
  36. public int idUser{ get; set; }
  37.  
  38. public string ComputerName {get;set;}
  39.  
  40. public virtual User User { get; set; }
  41. }
  42.  
  43. [Table("User")]
  44. public class User
  45. {
  46. [Key]
  47. public int idUser;
  48. public int idComputer;
  49. public virtual Computer Computer;
  50. }
  51.  
  52. [Table("Computer")]
  53. public class Computer
  54. {
  55.  
  56. [Key, ForeignKey("User")]
  57. public int idComputer;
  58. public virtual User User;
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement