using IRaCIS.Core.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;


namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
{
    public class TrialSiteConfigration : IEntityTypeConfiguration<TrialSite>
    {


        public void Configure(EntityTypeBuilder<TrialSite> builder)
        {
            //从 TrialSite 导航到TrialUserSite （Site下负责的CRC用户 ）会用两个建  trial Site列表会用到
            builder
           .HasMany(s => s.CRCUserList)
            .WithOne(c => c.TrialSite)
            .HasForeignKey(s => new { s.TrialId, s.SiteId })
            .HasPrincipalKey(c => new { c.TrialId, c.SiteId });

        }
    }
}
