forked from DavidMakarov/StudentEnrollment
26 lines
941 B
C#
26 lines
941 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using StudentEnrollmentDatabaseImplement.Models;
|
|
|
|
namespace StudentEnrollmentDatabaseImplement
|
|
{
|
|
public class StudentEnrollmentDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=StudentEnrollmentDatabase;Username=postgres;Password=postgres");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDataTimeInfinityConversions", true);
|
|
}
|
|
public virtual DbSet<Faculty> Faculties { get; set; }
|
|
public virtual DbSet<Course> Courses { get; set; }
|
|
public virtual DbSet<Student> Students { get; set; }
|
|
public virtual DbSet<StudentCourse> StudentCourses { get; set; }
|
|
public virtual DbSet<ExamPoints> ExamPointes { get; set; }
|
|
|
|
}
|
|
}
|