28 lines
1020 B
C#
28 lines
1020 B
C#
|
using ConfectioneryDatabaseImplement.Models;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using System.Diagnostics.Metrics;
|
|||
|
|
|||
|
namespace ConfectioneryDatabaseImplement
|
|||
|
{
|
|||
|
public class ConfectioneryDatabase : DbContext
|
|||
|
{
|
|||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|||
|
{
|
|||
|
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; }
|
|||
|
}
|
|||
|
}
|