ISEbd-21_Agliullov.D.A._Con.../ConfectioneryDatabaseImplement/ConfectioneryDatabase.cs
2023-03-06 14:55:11 +04:00

31 lines
1.2 KiB
C#

using ConfectioneryDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System.Diagnostics.Metrics;
namespace ConfectioneryDatabaseImplement
{
public class ConfectioneryDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// Перед работой необходимо установить SQL Express
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"
Server = localhost\SQLEXPRESS;
Initial Catalog = ConfectioneryDatabaseFull;
Integrated Security = True;
MultipleActiveResultSets = True;
TrustServerCertificate = True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Pastry> Pastries { set; get; }
public virtual DbSet<PastryComponent> PastryComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
}
}