81654c0d33
Add normalized service and template catalogs, scoped administration, migration, validation, and regression coverage. Ref: IT-1601
23 lines
1.1 KiB
C#
23 lines
1.1 KiB
C#
using HrynCo.NotificationService.DAL.EF.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace HrynCo.NotificationService.DAL.EF.Configurations;
|
|
|
|
internal sealed class ServiceLanguageEntityConfiguration : IEntityTypeConfiguration<ServiceLanguageEntity>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ServiceLanguageEntity> builder)
|
|
{
|
|
builder.ToTable("service_languages");
|
|
builder.HasKey(x => x.Id);
|
|
builder.Property(x => x.Id).HasColumnName("id");
|
|
builder.Property(x => x.ServiceId).HasColumnName("service_id");
|
|
builder.Property(x => x.Code).HasColumnName("code").HasMaxLength(10).IsRequired();
|
|
builder.HasIndex(x => new { x.ServiceId, x.Code }).IsUnique();
|
|
builder.HasAlternateKey(x => new { x.Id, x.ServiceId });
|
|
builder.HasOne(x => x.Service).WithMany(x => x.Languages).HasForeignKey(x => x.ServiceId).OnDelete(DeleteBehavior.Restrict);
|
|
builder.Property(x => x.Created).HasColumnName("created");
|
|
builder.Property(x => x.Updated).HasColumnName("updated");
|
|
}
|
|
}
|