mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
865 B
27 lines
865 B
using ErsatzTV.Core.Domain.Scheduling; |
|
using Microsoft.EntityFrameworkCore; |
|
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations.Scheduling; |
|
|
|
public class DecoTemplateConfiguration : IEntityTypeConfiguration<DecoTemplate> |
|
{ |
|
public void Configure(EntityTypeBuilder<DecoTemplate> builder) |
|
{ |
|
builder.ToTable("DecoTemplate"); |
|
|
|
builder.HasIndex(b => b.Name) |
|
.IsUnique(); |
|
|
|
builder.HasMany(b => b.Items) |
|
.WithOne(i => i.DecoTemplate) |
|
.HasForeignKey(i => i.DecoTemplateId) |
|
.OnDelete(DeleteBehavior.Cascade); |
|
|
|
builder.HasMany(t => t.PlayoutTemplates) |
|
.WithOne(t => t.DecoTemplate) |
|
.HasForeignKey(t => t.DecoTemplateId) |
|
.OnDelete(DeleteBehavior.SetNull) |
|
.IsRequired(false); |
|
} |
|
}
|
|
|