CourseWork_SchoolStudyAgain/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolDataBase.cs

46 lines
1.6 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using SchoolAgainStudyDataBaseImplements.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Metadata;
using System.Runtime.ConstrainedExecution;
using System.Text;
using System.Threading.Tasks;
using Task = SchoolAgainStudyDataBaseImplements.Models.Task;
namespace SchoolAgainStudyDataBaseImplements
{
public class SchoolDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Server=PostgreSQL;Host=localhost;Port=5432;Database=SchoolAgainStudyDataBase;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Student> Students { set; get; }
public virtual DbSet<Interest> Interests { set; get; }
public virtual DbSet<Diy> Diys { set; get; }
public virtual DbSet<DiyInterest> DiyInterests { set; get; }
public virtual DbSet<Product> Products { set; get; }
public virtual DbSet<ProductInterest> ProductInterests { set; get; }
public virtual DbSet<Teacher> Teachers { set; get; }
public virtual DbSet<Material> Materials { set; get; }
public virtual DbSet<Lesson> Lessons { set; get; }
public virtual DbSet<LessonMaterial> LessonMaterials { set; get; }
public virtual DbSet<Task> Tasks { set; get; }
public virtual DbSet<TaskMaterial> TaskMaterials { set; get; }
}
}