using Microsoft.EntityFrameworkCore; using WebApiWebSem.DataAccess.Models; namespace WebApiWebSem.DataAccess { public partial class WsDbContext : DbContext { public WsDbContext(DbContextOptions options) :base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasKey(c => new { c.id }); modelBuilder.Entity() .Property(e => e.created_at) .HasDefaultValueSql("now_utc()"); modelBuilder.Entity() .HasKey(c => new { c.article_id, c.property }); modelBuilder.Entity() .HasOne(e => e.fk_articles) .WithMany(e => e.articles_fields_fk) .HasForeignKey("article_id") .HasConstraintName("articles_fields_article_id_fkey"); } public virtual DbSet articles { get; set; } public virtual DbSet articles_fields { get; set; } } }