using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using OliverBooth.Common.Data.Web; namespace OliverBooth.Data.Web.Configuration; /// /// Represents the configuration for the entity. /// internal sealed class BookConfiguration : IEntityTypeConfiguration { /// public void Configure(EntityTypeBuilder builder) { builder.ToTable("Book"); builder.HasKey(entry => entry.Isbn); builder.Property(entry => entry.Isbn).IsRequired(); builder.Property(entry => entry.Title).IsRequired(); builder.Property(entry => entry.Author).IsRequired(); builder.Property(entry => entry.State).HasConversion>().IsRequired(); } }