2023-05-12 12:35:01 +04:00
|
|
|
|
using BookShopDataBaseImplement.Models;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace BookShopDataBaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class BookShopDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
2023-05-13 14:30:05 +04:00
|
|
|
|
optionsBuilder.UseNpgsql(@"Host=192.168.56.101;Port=5432;Database=BookShopOnline;Username=postgres;Password=1092010");
|
2023-05-12 12:35:01 +04:00
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
2023-05-13 14:30:05 +04:00
|
|
|
|
}
|
|
|
|
|
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; }
|
|
|
|
|
}
|
2023-05-12 12:35:01 +04:00
|
|
|
|
}
|