* upgrade dependencies * allow blocks with same name in different groups * code cleanup
22 lines
634 B
C#
22 lines
634 B
C#
using ErsatzTV.Core.Domain.Scheduling;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations.Scheduling;
|
|
|
|
public class BlockGroupConfiguration : IEntityTypeConfiguration<BlockGroup>
|
|
{
|
|
public void Configure(EntityTypeBuilder<BlockGroup> builder)
|
|
{
|
|
builder.ToTable("BlockGroup");
|
|
|
|
builder.HasIndex(b => b.Name)
|
|
.IsUnique();
|
|
|
|
builder.HasMany(b => b.Blocks)
|
|
.WithOne(i => i.BlockGroup)
|
|
.HasForeignKey(i => i.BlockGroupId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|