PIbd-21_Danilov_V.V._Course.../VeterinaryClinic/VeterinaryClinicDatabaseImplement/VeterinaryClinicDatabase.cs
2024-04-30 23:14:53 +04:00

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; }
}
}