RoleMap.cs 792 B

12345678910111213141516171819202122232425262728293031
  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 RoleMap : EntityTypeConfiguration<Core.Domain.User.Role>
  10. {
  11. public RoleMap()
  12. {
  13. ToTable("Role");
  14. HasKey(r => r.Id);
  15. Property(r => r.Description);
  16. Property(r => r.Level);
  17. Property(r => r.SeeOnlyAssigned);
  18. HasMany(r => r.Functions)
  19. .WithMany()
  20. .Map(m => m.ToTable("RoleFunctions"));
  21. HasMany(m => m.Users)
  22. .WithMany(u => u.Roles)
  23. .Map(m => m.ToTable("UserRoles"));
  24. }
  25. }
  26. }