CourseWork_SchoolStudyAgain/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolDataBase.cs
2023-05-17 21:29:39 +04:00

46 lines
1.6 KiB
C#

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(@"Host=localhost;Port=5432;Database=SchoolAgainStudyDataBase;Username=postgres;Password=186qazwsx");
}
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; }
}
}