PIbd-21_Yakovlev_M.G._CarRe.../CarRepairShop/CarRepairShopDatabaseImplement/CarRepairShopDatabase.cs

31 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarRepairShopDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace CarRepairShopDatabaseImplement
{
public class CarRepairShopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if(optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=CarRepairShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { get; set; }
public virtual DbSet<Repair> Repairs { get; set; }
public virtual DbSet<RepairComponent> RepairComponents { get; set; }
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Client> Clients { get; set; }
}
}