30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
using AccountManagement.Domain.PmDomains.PmUserAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace AccountMangement.Infrastructure.EFCore.Mappings.PmMappings;
|
|
|
|
public class PmUserMapping :IEntityTypeConfiguration<PmUser>
|
|
{
|
|
public void Configure(EntityTypeBuilder<PmUser> builder)
|
|
{
|
|
builder.ToTable("Users");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.FullName).HasMaxLength(100).IsRequired();
|
|
builder.Property(x => x.UserName).HasMaxLength(100).IsRequired();
|
|
builder.Property(x => x.Password).HasMaxLength(1000).IsRequired();
|
|
builder.Property(x => x.ProfilePhotoPath).HasMaxLength(500).IsRequired(false);
|
|
builder.Property(x => x.Mobile).HasMaxLength(20).IsRequired();
|
|
builder.Property(x => x.Email).HasMaxLength(150).IsRequired(false); ;
|
|
builder.Property(x => x.VerifyCode).HasMaxLength(10).IsRequired(false);
|
|
builder.OwnsMany(x => x.RoleUser, navigationBuilder =>
|
|
{
|
|
navigationBuilder.HasKey(x => x.Id);
|
|
navigationBuilder.ToTable("RoleUsers");
|
|
navigationBuilder.WithOwner(x => x.User);
|
|
});
|
|
|
|
|
|
}
|
|
} |