PIbd_23_Firsov_K._A._School/School/SchoolDatabaseImplement/SchoolDatabase.cs

36 lines
1.3 KiB
C#

using Microsoft.EntityFrameworkCore;
using SchoolDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolDatabaseImplement
{
public class SchoolDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder
optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=firsovpk;Initial Catalog=SchoolDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"
);
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<User> Users { set; get; }
public virtual DbSet<Lesson> Lessons { set; get; }
public virtual DbSet<InterestLesson> InterestLessons { set; get; }
public virtual DbSet<Interest> Interests { set; get; }
public virtual DbSet<Achievement> Achievements { set; get; }
public virtual DbSet<Club> Clubs { set; get; }
public virtual DbSet<ClubLesson> ClubLessons { set; get; }
public virtual DbSet<Material> Materials { set; get; }
public virtual DbSet<InterestMaterial> InterestMaterials { set; get; }
}
}