37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
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(@"
|
|
Host=localhost;
|
|
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; }
|
|
}
|
|
}
|