26 lines
736 B
C#
26 lines
736 B
C#
using ErsatzTV.Core.Domain;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations;
|
|
|
|
public class PlayoutItemConfiguration : IEntityTypeConfiguration<PlayoutItem>
|
|
|
|
{
|
|
public void Configure(EntityTypeBuilder<PlayoutItem> builder)
|
|
{
|
|
builder.ToTable("PlayoutItem");
|
|
|
|
builder.HasOne(pi => pi.MediaItem)
|
|
.WithMany()
|
|
.HasForeignKey(pi => pi.MediaItemId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasOne(i => i.Watermark)
|
|
.WithMany()
|
|
.HasForeignKey(i => i.WatermarkId)
|
|
.OnDelete(DeleteBehavior.SetNull)
|
|
.IsRequired(false);
|
|
}
|
|
}
|