25 lines
883 B
C#
25 lines
883 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace EkzamenDatabaseImplement
|
|
{
|
|
public class ConfectioneryDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
// Перед работой необходимо установить SQL Express
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseSqlServer(@"
|
|
Server = localhost\SQLEXPRESS;
|
|
Initial Catalog = EkzamenDatabaseFull;
|
|
Integrated Security = True;
|
|
MultipleActiveResultSets = True;
|
|
TrustServerCertificate = True");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
public virtual DbSet<Student> Students { set; get; }
|
|
public virtual DbSet<Group> Groups { set; get; }
|
|
}
|
|
}
|