using example_csharp_app.Dto; using Microsoft.EntityFrameworkCore; using System; namespace example_app.Database.Connector; public class AppDbContext(DbContextOptions options) : DbContext(options) { public DbSet Books { set; get; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity() .ToTable("Books") .HasKey(x => x.Id); builder.Entity() .Property(x => x.Author) .IsRequired(); builder.Entity() .Property(x => x.Title) .IsRequired(); builder.Entity() .Property(x => x.YearPublished) .IsRequired(); builder.Entity() .Property(x => x.BookIndex) .IsRequired(); builder.Entity() .Property(x => x.BookIndex) .HasColumnType("xml"); } }