Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. public InstituicaoMap()
  2. {
  3. // Primary Key
  4. HasKey(t => t.IdInstituicao);
  5.  
  6. // Properties
  7. Property(t => t.Nome)
  8. .IsRequired()
  9. .HasMaxLength(255);
  10. }
  11.  
  12. public CampanhaMap()
  13. {
  14. // Primary Key
  15. this.HasKey(t => t.IdCampanha);
  16.  
  17. // Properties
  18. this.Property(t => t.Texto)
  19. .IsRequired()
  20. .HasMaxLength(160);
  21.  
  22. this.Property(t => t.DataEdicao)
  23. .IsFixedLength()
  24. .HasMaxLength(8)
  25. .IsRowVersion();
  26.  
  27. // Relationships
  28. this.HasRequired(t => t.Instituicao)
  29. .WithMany(t => t.Campanhas)
  30. .HasForeignKey(d => d.IdInstituicao);
  31. }
  32.  
  33. return new ContentResult
  34. {
  35. Content = JsonConvert.SerializeObject(v),
  36. ContentType = "application/json"
  37. };
  38.  
  39. [JsonIgnore]
  40. public virtual Instituicao Instituicao{get;set;}
  41.  
  42. public CampanhaMap()
  43. {
  44. // Primary Key
  45. this.HasKey(t => t.IdCampanha);
  46.  
  47. // Properties
  48. this.Property(t => t.Texto)
  49. .IsRequired()
  50. .HasMaxLength(160);
  51.  
  52. this.Property(t => t.DataEdicao)
  53. .IsFixedLength()
  54. .HasMaxLength(8)
  55. .IsRowVersion();
  56.  
  57. // Relationships
  58. this.HasRequired(t => t.Instituicao)
  59. .WithMany(t => t.Campanhas)
  60. .HasForeignKey(d => d.IdInstituicao);
  61.  
  62. this.Ignore(t => t.Instituicao);
  63.  
  64. }
  65.  
  66. public YouContext(): base("name=SchoolDBEntities")
  67. {
  68. this.Configuration.LazyLoadingEnabled = false;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement