PIbd-23_Sergunov_M.A._SUBD/BookShop/BookShopDataBaseImplement/BookShopDatabase.cs

24 lines
838 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=BookShopOnline;Username=postgres;Password=1092010");
}
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; }
}
}