-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepositoryContext.cs
More file actions
29 lines (26 loc) · 936 Bytes
/
RepositoryContext.cs
File metadata and controls
29 lines (26 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Microsoft.EntityFrameworkCore;
using SchoolAPI.Models;
namespace SchoolAPI
{
public class RepositoryContext : DbContext
{
public RepositoryContext(DbContextOptions<RepositoryContext> options) : base(options)
{
}
public DbSet<Boleta> Boletas { get; set; }
public DbSet<Calificacion> Calificacions { get; set; }
public DbSet<Grado> Grados { get; set; }
public DbSet<GradoUsuario> GradoUsuarios { get; set; }
public DbSet<Materia> Materias { get; set; }
public DbSet<Rol> Roles { get; set; }
public DbSet<Usuario> Usuarios { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Usuario>()
.HasIndex(u => u.Correo)
.IsUnique();
builder.Entity<Usuario>()
.HasIndex(u => u.Iae).IsUnique();
}
}
}