24 lines
889 B
C#
24 lines
889 B
C#
using JSMR.Domain.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace JSMR.Infrastructure.Data.Configuration;
|
|
|
|
public sealed class VoiceWorkSupportedLanguageConfiguration : IEntityTypeConfiguration<VoiceWorkSupportedLanguage>
|
|
{
|
|
public void Configure(EntityTypeBuilder<VoiceWorkSupportedLanguage> builder)
|
|
{
|
|
builder.ToTable("voice_work_supported_languages");
|
|
builder.HasKey(x => x.VoiceWorkSupportedLanguageId);
|
|
|
|
builder.Property(x => x.Language).IsRequired().HasMaxLength(10);
|
|
|
|
builder.HasOne(x => x.VoiceWork)
|
|
.WithMany(v => v.SupportedLanguages)
|
|
.HasForeignKey(x => x.VoiceWorkId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasIndex(x => new { x.VoiceWorkId, x.Language }).IsUnique();
|
|
builder.HasIndex(x => x.VoiceWorkId);
|
|
}
|
|
} |