PIbd-42_Kashin_M.I_CPO_Cour.../Model/Data/ApplicationConext.cs

27 lines
847 B
C#
Raw Normal View History

2024-11-26 15:30:46 +04:00
using EmployeeManager.Model;
using Microsoft.EntityFrameworkCore;
namespace EmployeeManager.Model.Data
2024-11-26 15:30:46 +04:00
{
public class ApplicationConext : DbContext
{
public DbSet<Employee> Employees { get; set; }
public DbSet<PhysicalPerson> PhysicalPersons { get; set; }
public DbSet<Salary> Salaries { get; set; }
public DbSet<Vacation> Vacations { get; set; }
public ApplicationConext()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseNpgsql("Host=localhost;Database=EmployeeManagerDataBase;Username=postgres;Password=23859");
}
base.OnConfiguring(optionsBuilder);
}
}
}