mirror of
https://github.com/guilhermewerner/gerencia-projetos
synced 2025-06-16 15:05:39 +00:00
Initial commit
This commit is contained in:
35
GerenciaProjetos/Data/AppContext.cs
Normal file
35
GerenciaProjetos/Data/AppContext.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GerenciaProjetos.Models;
|
||||
|
||||
namespace GerenciaProjetos.Data
|
||||
{
|
||||
public class AppContext : DbContext
|
||||
{
|
||||
public DbSet<Bug> Bugs { get; set; }
|
||||
public DbSet<Desenvolvedor> Desenvolvedores { get; set; }
|
||||
public DbSet<Projeto> Projetos { get; set; }
|
||||
public DbSet<Requisito> Requisitos { get; set; }
|
||||
|
||||
public DbSet<DesenvolvedorProjeto> DesenvolvedorProjeto { get; set; }
|
||||
public DbSet<DesenvolvedorRequisito> DesenvolvedorRequisito { get; set; }
|
||||
|
||||
public AppContext(DbContextOptions o) : base(o)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Bug>()
|
||||
.HasKey(c => new { c.DesenvolvedorId, c.RequisitoId });
|
||||
modelBuilder.Entity<DesenvolvedorProjeto>()
|
||||
.HasKey(c => new { c.DesenvolvedorId, c.ProjetoId });
|
||||
modelBuilder.Entity<DesenvolvedorRequisito>()
|
||||
.HasKey(c => new { c.DesenvolvedorId, c.RequisitoId });
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user