ISEbd-21_Koscheev.M.S.Softw.../SoftwareInstallation/SoftwareInstallationDatabaseImplement/SoftwareInstallationDatabase.cs

27 lines
1.1 KiB
C#
Raw Normal View History

2023-03-05 19:26:08 +04:00
using SoftwareInstallationDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace SoftwareInstallationDatabaseImplement
{
public class SoftwareInstallationDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// Перед работой необходимо установить SQL Express
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"
Server = localhost\SQLEXPRESS;
Initial Catalog = SoftwareInstallationDatabaseFull;
Integrated Security = True;
MultipleActiveResultSets = True;
TrustServerCertificate = True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Package> Packages { set; get; }
public virtual DbSet<PackageComponent> PackageComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
}
}