30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using PrecastConcretePlantDatabaseImplement.Models;
|
|
|
|
namespace PrecastConcretePlantDatabaseImplement
|
|
{
|
|
public class PrecastConcretePlantDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
// Перед работой необходимо установить SQL Express
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseSqlServer(@"
|
|
Server = localhost\SQLEXPRESS;
|
|
Initial Catalog = PrecastConcretePlantDatabaseDatabaseFull;
|
|
Integrated Security = True;
|
|
MultipleActiveResultSets = True;
|
|
TrustServerCertificate = True");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
public virtual DbSet<Component> Components { set; get; }
|
|
public virtual DbSet<Reinforced> Reinforceds { set; get; }
|
|
public virtual DbSet<ReinforcedComponent> ReinforcedComponents { set; get; }
|
|
public virtual DbSet<Order> Orders { set; get; }
|
|
public virtual DbSet<Shop> Shops { set; get; }
|
|
public virtual DbSet<ShopReinforced> ShopReinforceds { set; get; }
|
|
}
|
|
}
|