2024-03-10 01:33:27 +04:00
|
|
|
|
using AircraftPlantDatabaseImplement.Models;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AircraftPlantDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс для взаимодействия с базой данных
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AircraftPlantDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Подключение к базе данных
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="optionsBuilder"></param>
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
|
|
|
|
optionsBuilder.UseSqlServer(@"Data Source=FACTORINO\SQLEXPRESS;Initial Catalog=AircraftPlantDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Таблица компонентов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual DbSet<Component> Components { set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Таблица изделий
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual DbSet<Plane> Planes { set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Связь между изделиями и компонентами
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual DbSet<PlaneComponent> PlaneComponents { set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Таблица заказов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual DbSet<Order> Orders { set; get; }
|
2024-04-07 00:02:29 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Таблица клиентов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual DbSet<Client> Clients { set; get; }
|
2024-03-10 01:33:27 +04:00
|
|
|
|
}
|
|
|
|
|
}
|