RoleConfiguration.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Microsoft.AspNetCore.Identity;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. using MTWorkHR.Identity.Entities;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace MTWorkHR.Identity.Configurations
  11. {
  12. public class RoleConfiguration : IEntityTypeConfiguration<ApplicationRole>
  13. {
  14. public void Configure(EntityTypeBuilder<ApplicationRole> builder)
  15. {
  16. builder.HasData(
  17. new ApplicationRole
  18. {
  19. Id = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
  20. Name = "Admin",
  21. NormalizedName = "ADMIN",
  22. IsAdmin = true,
  23. IsDeleted = false,
  24. },
  25. new ApplicationRole
  26. {
  27. Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E",
  28. Name = "Employee",
  29. NormalizedName = "EMPLOYEE",
  30. IsAdmin = false,
  31. IsDeleted = false,
  32. }
  33. );
  34. }
  35. }
  36. }