MailNotificationMap.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
  8. namespace GreenTree.Nachtragsmanagement.Data.Mapping.Misc
  9. {
  10. public class MailNotificationMap : EntityTypeConfiguration<MailNotification>
  11. {
  12. public MailNotificationMap()
  13. {
  14. ToTable("MailNotification");
  15. HasKey(m => m.Id);
  16. Property(m => m.CronExpression);
  17. Property(m => m.IsDailySummary);
  18. Property(m => m.IsWeeklySummary);
  19. Property(m => m.IsMonthlySummary);
  20. HasOptional(m => m.NotificationEvent)
  21. .WithMany()
  22. .HasForeignKey(m => m.NotificationEventId);
  23. HasOptional(m => m.NotificationEventType)
  24. .WithMany()
  25. .HasForeignKey(m => m.NotificationEventTypeId);
  26. HasMany(m => m.Users)
  27. .WithMany(u => u.MailNotifications)
  28. .Map(m => m.ToTable("UserMailNotifications"));
  29. }
  30. }
  31. }