EI-Image-Viewer-Api/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs

24 lines
718 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 });
}
}
}