33 lines
1.3 KiB
C#
33 lines
1.3 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Options;
|
|
using VeterinaryClinicDatabaseImplement.Models;
|
|
|
|
namespace VeterinaryClinicDatabaseImplement
|
|
{
|
|
public class VeterinaryClinicDatabase: DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=VeterinaryClinicDatabase;Username=postgres;Password=postgres");
|
|
}
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
}
|
|
|
|
public virtual DbSet<Animal> Animals { set; get; }
|
|
public virtual DbSet<AnimalMedication> AnimalMedications { set; get; }
|
|
public virtual DbSet<Medication> Medications { set; get; }
|
|
public virtual DbSet<Service> Services { set; get; }
|
|
public virtual DbSet<User> Users { set; get; }
|
|
public virtual DbSet<Vaccination> Vaccinations { set; get; }
|
|
public virtual DbSet<Visit> Visits { set; get; }
|
|
public virtual DbSet<VisitAnimal> VisitAnimals { set; get; }
|
|
public virtual DbSet<VisitService> VisitServices { set; get; }
|
|
}
|
|
}
|