AppendixMap.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity.ModelConfiguration;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace GreenTree.Nachtragsmanagement.Data.Mapping.Appendix
  8. {
  9. public class AppendixMap : EntityTypeConfiguration<Core.Domain.Appendix.Appendix>
  10. {
  11. public AppendixMap()
  12. {
  13. ToTable("Appendix");
  14. HasKey(a => a.Id);
  15. HasOptional(a => a.State)
  16. .WithMany()
  17. .HasForeignKey(a => a.StateId);
  18. HasOptional(a => a.Site)
  19. .WithMany(s => s.Appendices)
  20. .HasForeignKey(a => a.SiteId);
  21. Property(a => a.CustomNumber);
  22. Property(a => a.Description);
  23. Property(a => a.Comment);
  24. Property(a => a.Value);
  25. Property(a => a.Probability);
  26. Property(a => a.OfferingNumber);
  27. Property(a => a.OfferingDate);
  28. Property(a => a.NegotiationDate);
  29. Property(a => a.NegotiationValue);
  30. Property(a => a.ProtocolExists);
  31. Property(a => a.OrderInvoiceCreated);
  32. Property(a => a.OrderNumber);
  33. Property(a => a.OrderDate);
  34. HasMany(s => s.CategoryValues)
  35. .WithMany()
  36. .Map(a => a.ToTable("AppendixCategoryValues"));
  37. HasMany(s => s.Deviations)
  38. .WithOptional();
  39. HasMany(s => s.Invoices)
  40. .WithOptional();
  41. }
  42. }
  43. }