Pibd-22_Morozov_V.S_Automob.../AutomobilePlant/AutomobilePlantDataBaseImplements/AutoPlantDataBase.cs

34 lines
1.1 KiB
C#
Raw Normal View History

using AutomobilePlantDataBaseImplements.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutomobilePlantDataBaseImplements
{
public class AutoPlantDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
2023-05-02 12:50:43 +04:00
optionsBuilder.UseNpgsql("Server=PostgreSQL;Host=localhost;Port=5432;Database=AutoPlantDataBaseHard;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Car> Cars { set; get; }
public virtual DbSet<CarComponent> CarComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
2023-05-02 12:50:43 +04:00
public virtual DbSet<CarShop> CarShops { set; get; }
public virtual DbSet<ShopCar> ShopCars { get; set; }
}
}