PIbd-23_Starostin_I.K._Cour.../STODataBaseImplement/STODatabase.cs

34 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.SqlServer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DatabaseImplement;
namespace STODatabaseImplement
{
public class STODatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=STODataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<TechnicalWork> TechnicalWorks { set; get; }
public virtual DbSet<Car> Cars { set; get; }
public virtual DbSet<Service> Services { set; get; }
public virtual DbSet<CarPart> CarParts { set; get; }
public virtual DbSet<Work> Works { set; get; }
//public virtual DbSet<CarPartCar> CarPartCar { set; get; }
public virtual DbSet<CarPartWork> CarPartWork { set; get; }
public virtual DbSet<CarTechnicalWork> CarTechnicalWork { set; get; }
public virtual DbSet<WorkTechnicalWork> WorkTechnicalWork { set; get; }
}
}