Added configurations for entity builders. Also added VoiceWorkLocaalization entity.

This commit is contained in:
2025-08-27 00:16:10 -04:00
parent d2201d6f9b
commit 22b8513e34
16 changed files with 299 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using JSMR.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace JSMR.Infrastructure.Data.Configuration;
public sealed class VoiceWorkLocalizationConfiguration : IEntityTypeConfiguration<VoiceWorkLocalization>
{
public void Configure(EntityTypeBuilder<VoiceWorkLocalization> builder)
{
builder.ToTable("voice_work_localizations");
builder.HasKey(x => x.VoiceWorkLocalizationId);
builder.Property(x => x.Language).IsRequired().HasMaxLength(10);
builder.Property(x => x.ProductName).HasMaxLength(256);
builder.Property(x => x.Description).HasMaxLength(512);
builder.HasOne(x => x.VoiceWork)
.WithMany(v => v.Localizations)
.HasForeignKey(x => x.VoiceWorkId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(x => new { x.VoiceWorkId, x.Language }).IsUnique();
builder.HasIndex(x => x.VoiceWorkId);
builder.HasIndex(x => x.ProductName);
}
}