2023-05-08 13:51:25 +04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using RestaurantDatabaseImplement.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace RestaurantDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class RestaurantDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
|
|
|
|
optionsBuilder.UseNpgsql(@"
|
2023-05-17 00:48:03 +04:00
|
|
|
|
Host=192.168.0.108;
|
2023-05-08 13:51:25 +04:00
|
|
|
|
Port=5432;
|
|
|
|
|
Database=RestaurantDatabase;
|
|
|
|
|
Username=postgres;
|
|
|
|
|
Password=postgres");
|
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual DbSet<Component> Components { set; get; }
|
|
|
|
|
public virtual DbSet<Product> Products { set; get; }
|
|
|
|
|
public virtual DbSet<ProductComponent> ProductComponents { set; get; }
|
|
|
|
|
public virtual DbSet<Provider> Providers { set; get; }
|
|
|
|
|
public virtual DbSet<ComponentProvider> ComponentProviders { set; get; }
|
|
|
|
|
public virtual DbSet<Order> Orders { set; get; }
|
|
|
|
|
public virtual DbSet<OrderProduct> OrderProducts { set; get; }
|
|
|
|
|
public virtual DbSet<Client> Clients { set; get; }
|
|
|
|
|
}
|
|
|
|
|
}
|