PIbd-21_Kurs_Work_Hotel/Hotel/HotelDataBaseImplement/HotelDataBase.cs
2024-04-28 18:11:56 +04:00

35 lines
1.5 KiB
C#

using HotelDataBaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System.Reflection;
namespace HotelDataBaseImplement
{
public class HotelDataBase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=Hotel_bd;Username=postgres;Password=admin");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
public virtual DbSet<Conference> Conferences { get; set; }
public virtual DbSet<MealPlan> MealPlans { set; get; }
public virtual DbSet<Participant> Participants { set; get; }
public virtual DbSet<Organiser> Organisers { set; get; }
public virtual DbSet<Administrator> Administrators { set; get; }
public virtual DbSet<ConferenceBooking> ConferenceBookings { set; get; }
public virtual DbSet<Room> Rooms { set; get; }
public virtual DbSet<Dinner> Dinners { set; get; }
public virtual DbSet<ConferenceBookingDinner> ConferenceBookingDinners { set; get; }
public virtual DbSet<ConferenceParticipant> ConferenceParticipants { set; get; }
public virtual DbSet<MealPlanParticipant> MealPlanParticipants { set; get; }
public virtual DbSet<MealPlanRoom> MealPlanRooms { set; get; }
public virtual DbSet<RoomDinner> RoomDinners { set; get; }
}
}