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

27 lines
930 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityDataBaseImplemet.Models;
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<Document> Documents { get; set; }
public virtual DbSet<EducationStatus> EducationStatuses { get; set; }
public virtual DbSet<Student> Students { get; set; }
public virtual DbSet<StudentDocument> StudentDocuments { get; set; }
}
}