using Core.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Data.Configurations; public class PrintPresetConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasKey(p => p.Id); builder.Property(p => p.Name) .IsRequired() .HasMaxLength(100); builder.HasIndex(p => p.Name) .IsUnique(); builder.Property(p => p.EntityType) .HasConversion() .HasMaxLength(32) .IsRequired(); builder.Property(p => p.FiltersJson) .IsRequired() .HasColumnType("TEXT"); builder.HasOne(p => p.Note) .WithMany() .HasForeignKey(p => p.NoteId) .OnDelete(DeleteBehavior.Restrict) .IsRequired(); } }