CourseWork_ServiceStation/ServiceStation/ServiceStationDatabaseImplement/ServiceStationDatabase.cs

31 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using ServiceStationDatabaseImplement.Models;
namespace ServiceStationDatabaseImplement
{
public class ServiceStationDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if(optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=ServiceStationDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Car> Cars { get; set; }
public virtual DbSet<Defect> Defects { get; set; }
public virtual DbSet<CarDefect> CarDefects { get; set; }
public virtual DbSet<Executor> Executors { get; set; }
public virtual DbSet<TechnicalWork> TechnicalWorks { get; set; }
public virtual DbSet<CarTechnicalWork> CarTechnicalWorks { get; set; }
}
}