2024-11-12 22:10:44 +04:00
|
|
|
|
using EmployeeManagmentDataBaseImplement.Models;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace EmployeeManagmentDataBaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class EmployeeManagementDbContext : DbContext
|
|
|
|
|
{
|
2024-11-13 14:41:01 +04:00
|
|
|
|
// DbSets для моделей
|
|
|
|
|
public virtual DbSet<Employee> Employees { get; set; }
|
|
|
|
|
public virtual DbSet<PhisicalPerson> PhysicalPersons { get; set; }
|
|
|
|
|
public virtual DbSet<Salary> Salaries { get; set; }
|
|
|
|
|
public virtual DbSet<Vacation> Vacations { get; set; }
|
2024-11-12 22:10:44 +04:00
|
|
|
|
|
2024-11-13 14:41:01 +04:00
|
|
|
|
// Метод для настройки конфигурации
|
2024-11-12 22:10:44 +04:00
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
2024-11-13 14:41:01 +04:00
|
|
|
|
if (!optionsBuilder.IsConfigured)
|
|
|
|
|
{
|
2024-11-26 21:24:08 +04:00
|
|
|
|
optionsBuilder.UseNpgsql("Host=localhost;Database=EmployeeManagementDB;Username=postgres;Password=23859");
|
2024-11-13 14:41:01 +04:00
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
2024-11-12 22:10:44 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|