initial
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using _2021_backend.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace _2021_backend.Data
|
||||
{
|
||||
public class BackendContext : DbContext
|
||||
{
|
||||
public BackendContext(DbContextOptions<BackendContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<Submission> Submissions { get; set; }
|
||||
public DbSet<Comment> Comments { get; set; }
|
||||
public DbSet<Session> Sessions { get; set; }
|
||||
public DbSet<Student> Students { get; set; }
|
||||
public DbSet<SMS> SMS { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder mb)
|
||||
{
|
||||
mb.Entity<Submission>()
|
||||
.HasKey(r => r.Guid);
|
||||
mb.Entity<User>()
|
||||
.HasKey(u => u.Guid);
|
||||
mb.Entity<Comment>()
|
||||
.HasKey(u => u.Guid);
|
||||
mb.Entity<Session>()
|
||||
.HasKey(u => u.Guid);
|
||||
mb.Entity<SMS>()
|
||||
.HasKey(u => u.Guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user