27 lines
841 B
C#
27 lines
841 B
C#
|
using EmployeeManager.Model;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
|||
|
namespace EmployeeManager.Data
|
|||
|
{
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|