添加项目文件。
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using GroupService.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GroupService.Infrastructure.Configs
|
||||
{
|
||||
public class GroupJoinRequestConfig : IEntityTypeConfiguration<GroupJoinRequest>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<GroupJoinRequest> builder)
|
||||
{
|
||||
builder.ToTable("group_join_requests");
|
||||
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.GroupProfile, u =>
|
||||
{
|
||||
u.Property(p => p.Avatar)
|
||||
.IsRequired()
|
||||
.HasMaxLength(100);
|
||||
|
||||
u.Property(p => p.GroupName)
|
||||
.IsRequired()
|
||||
.HasMaxLength(20);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user