30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using HotelDatabaseImplement.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HotelDatabaseImplement
|
|
{
|
|
public class HotelDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=Hotel_Subd_DB;Username=postgres;Password=admin");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
}
|
|
public virtual DbSet<Booking> Bookings { get; set; }
|
|
public virtual DbSet<Client> Clients { get; set; }
|
|
public virtual DbSet<Post> Posts { get; set; }
|
|
public virtual DbSet<Room> Rooms { get; set; }
|
|
public virtual DbSet<Worker> Workers { get; set; }
|
|
}
|
|
}
|