Added configurations for entity builders. Also added VoiceWorkLocaalization entity.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using JSMR.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace JSMR.Infrastructure.Data.Configuration;
|
||||
|
||||
public sealed class EnglishVoiceWorkConfiguration : IEntityTypeConfiguration<EnglishVoiceWork>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<EnglishVoiceWork> builder)
|
||||
{
|
||||
builder.ToTable("english_voice_works");
|
||||
builder.HasKey(x => x.EnglishVoiceWorkId);
|
||||
|
||||
builder.Property(x => x.ProductName).HasMaxLength(256);
|
||||
builder.Property(x => x.Description).HasMaxLength(512);
|
||||
|
||||
builder.HasOne(x => x.VoiceWork)
|
||||
.WithMany(v => v.EnglishVoiceWorks)
|
||||
.HasForeignKey(x => x.VoiceWorkId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasIndex(x => x.VoiceWorkId).IsUnique();
|
||||
builder.HasIndex(x => x.IsValid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user