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

31 lines
1.0 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; }
}
}