24 lines
821 B
C#
24 lines
821 B
C#
using AccountManagement.Domain.PmDomains.PmRoleAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace AccountMangement.Infrastructure.EFCore.Mappings.PmMappings;
|
|
|
|
public class PmRoleMapping : IEntityTypeConfiguration<PmRole>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PmRole> builder)
|
|
{
|
|
builder.ToTable("PmRoles", t => t.ExcludeFromMigrations());
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.RoleName).HasMaxLength(100).IsRequired();
|
|
|
|
builder.OwnsMany(x => x.PmPermission, navigationBuilder =>
|
|
{
|
|
navigationBuilder.HasKey(x => x.Id);
|
|
navigationBuilder.ToTable("PmRolePermissions", t => t.ExcludeFromMigrations());
|
|
|
|
navigationBuilder.WithOwner(x => x.Role);
|
|
});
|
|
}
|
|
} |