ISEbd-21_Koscheev.M.S.Softw.../SoftwareInstallation/SoftwareInstallationDatabaseImplement/SoftwareInstallationDatabase.cs
2023-04-03 17:46:11 +04:00

29 lines
1.2 KiB
C#

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; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
}
}