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.
26 lines
802 B
26 lines
802 B
using ErsatzTV.Core.Domain.Scheduling; |
|
using Microsoft.EntityFrameworkCore; |
|
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations.Scheduling; |
|
|
|
public class TemplateConfiguration : IEntityTypeConfiguration<Template> |
|
{ |
|
public void Configure(EntityTypeBuilder<Template> builder) |
|
{ |
|
builder.ToTable("Template"); |
|
|
|
builder.HasIndex(b => b.Name) |
|
.IsUnique(); |
|
|
|
builder.HasMany(b => b.Items) |
|
.WithOne(i => i.Template) |
|
.HasForeignKey(i => i.TemplateId) |
|
.OnDelete(DeleteBehavior.Cascade); |
|
|
|
builder.HasMany(t => t.PlayoutTemplates) |
|
.WithOne(t => t.Template) |
|
.HasForeignKey(t => t.TemplateId) |
|
.OnDelete(DeleteBehavior.Cascade); |
|
} |
|
}
|
|
|