32 lines
957 B
C#
32 lines
957 B
C#
|
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)
|
|||
|
{
|
|||
|
optionsBuilder.UseNpgsql("Server=PostgreSQL;Host=localhost;Port=5432;Database=AutoPlantDataBase;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; }
|
|||
|
}
|
|||
|
}
|