PIbd-22_Filippov_D.S._Cours.../VeterinaryDatabaseImplement/VeterinaryDatabase.cs

36 lines
1.3 KiB
C#
Raw Permalink Normal View History

2024-05-30 07:33:38 +04:00

using VeterinaryDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace VeterinaryDatabaseImplement
{
public class VeterinaryDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
{
if (!OptionsBuilder.IsConfigured)
{
OptionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=vet;Username=postgres;Password=postgres");
}
base.OnConfiguring(OptionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
}
public virtual DbSet<Doctor> Doctors { set; get; }
public virtual DbSet<Drug> Drugs { set; get; }
public virtual DbSet<Medication> Medications { set; get; }
public virtual DbSet<Service> Services { set; get; }
public virtual DbSet<ServiceMedication> ServiceMedications { set; get; }
public virtual DbSet<DrugMedication> DrugMedications{ set; get; }
public virtual DbSet<DrugService> DrugServices { set; get; }
//public virtual DbSet<MedicationPet> MedicationPets { set; get; }
public virtual DbSet<Owner> Owners { set; get; }
public virtual DbSet<Pet> Pets { set; get; }
public virtual DbSet<Visit> Visits { set; get; }
public virtual DbSet<Purchase> Purchases { set; get; }
public virtual DbSet<VisitPet> VisitPets { set; get; }
public virtual DbSet<PurchasePet> PurchasePets { set; get; }
}
}