PIbd-21_Pyatakov_KM_Markov_.../UniversityDataBaseImplemet/Database.cs

31 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore;
using UniversityDataBaseImplemet.Models;
using Stream = UniversityDataBaseImplemet.Models.Stream;
namespace UniversityDataBaseImplemet
{
public class Database : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=University;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<User> User { get; set; }
public virtual DbSet<Document> Documents { get; set; }
public virtual DbSet<Discipline> Discipline { get; set; }
public virtual DbSet<EducationStatus> EducationStatuses { get; set; }
public virtual DbSet<EducationGroup> EducationGroups { get; set; }
public virtual DbSet<EducationGroupDocument> EducationGroupsDocuments { get; set; }
public virtual DbSet<EducationGroupStream> EducationGroupsStreams { get; set; }
public virtual DbSet<Stream> Streams { get; set; }
public virtual DbSet<Student> Students { get; set; }
public virtual DbSet<StudentDocument> StudentDocuments { get; set; }
public virtual DbSet<StudentStream> StudentStreams { get; set; }
public virtual DbSet<Role> Roles { get; set; }
}
}