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