using Koogle.Domain.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Koogle.Infrastructure.Data.Configurations; public class GamePersonConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("GamePersons"); builder.HasKey(x => new { x.GameId, x.PersonId }); builder.HasOne(x => x.Game) .WithMany(x => x.GamePersons) .HasForeignKey(x => x.GameId) .OnDelete(DeleteBehavior.Cascade); builder.HasOne(x => x.Person) .WithMany() .HasForeignKey(x => x.PersonId) .OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => x.PersonId); } }