PIbd-23_Sergunov_M.A._SUBD/BookShop/BookShopDataBaseImplement/BookShopDatabase.cs
2023-05-12 12:35:01 +04:00

24 lines
879 B
C#

using BookShopDataBaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace BookShopDataBaseImplement
{
public class BookShopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=192.168.56.101;Port=5432;Database=SUBD_Lab2;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Author> Authors { set; get; }
public virtual DbSet<Book> Books { set; get; }
public virtual DbSet<BookAuthor> BookAuthors { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Genre> Genres { set; get; }
}
}