using Entities.Contracts; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace TechHelper.Context.Configuration { public class RoleConfiguration : IEntityTypeConfiguration> { public void Configure(EntityTypeBuilder> builder) { builder.HasData( Enum.GetValues(typeof(UserRoles)) .Cast() .Select(roleEnum => new IdentityRole { Id = Guid.NewGuid(), Name = roleEnum.ToString(), NormalizedName = roleEnum.ToString().ToUpper() }) .ToArray()); } } }