using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using GerenciaProjetos.Models; namespace GerenciaProjetos.Data { public class GerenciaContext : DbContext { public DbSet Bugs { get; set; } public DbSet Desenvolvedores { get; set; } public DbSet Projetos { get; set; } public DbSet Requisitos { get; set; } public DbSet DesenvolvedorProjeto { get; set; } public DbSet DesenvolvedorRequisito { get; set; } public GerenciaContext(DbContextOptions o) : base(o) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasKey(b => new { b.DesenvolvedorId, b.RequisitoId }); modelBuilder.Entity() .HasKey(p => new { p.DesenvolvedorId, p.ProjetoId }); modelBuilder.Entity() .HasKey(r => new { r.DesenvolvedorId, r.RequisitoId }); } } }