UserMap.cs 955 B

123456789101112131415161718192021222324252627282930313233343536
  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.User
  8. {
  9. public class UserMap : EntityTypeConfiguration<Core.Domain.User.User>
  10. {
  11. public UserMap()
  12. {
  13. ToTable("User");
  14. HasKey(u => u.Id);
  15. Property(u => u.CustomNumber);
  16. Property(u => u.Forename);
  17. Property(u => u.Lastname);
  18. Property(u => u.MailAddress);
  19. Property(u => u.Password);
  20. Property(u => u.IsChanged);
  21. Ignore(u => u.CurrentRole);
  22. HasMany(c => c.Roles)
  23. .WithMany()
  24. .Map(m => m.ToTable("UserRoles"));
  25. HasMany(c => c.MailNotifications)
  26. .WithMany()
  27. .Map(m => m.ToTable("UserMailNotifications"));
  28. }
  29. }
  30. }