Files
2026-05-09 17:06:30 +08:00

47 lines
1.4 KiB
C#

using GroupService.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace GroupService.Infrastructure.Configs
{
public class GroupInvitationConfig : IEntityTypeConfiguration<GroupInvitation>
{
public void Configure(EntityTypeBuilder<GroupInvitation> builder)
{
builder.ToTable("group_invitations");
builder.HasKey(x => x.Id);
builder.HasKey(x => new { x.GroupId, x.UserId });
builder.ComplexProperty(x => x.UserProfile, u =>
{
u.Property(p => p.Avatar)
.HasMaxLength(100);
u.Property(p => p.NickName)
.IsRequired()
.HasMaxLength(20);
});
builder.ComplexProperty(x => x.OperatorProfile, u =>
{
u.Property(p => p.Avatar)
.HasMaxLength(100);
u.Property(p => p.NickName)
.IsRequired()
.HasMaxLength(20);
});
builder.ComplexProperty(x => x.GroupProfile, u =>
{
u.Property(p => p.Avatar)
.IsRequired()
.HasMaxLength(100);
u.Property(p => p.GroupName)
.IsRequired()
.HasMaxLength(20);
});
}
}
}