PIbd-22_Chubykina_SUBD_Book.../Bookshop/BookshopDatabaseImplement/BookshopDatabase.cs

30 lines
1.1 KiB
C#
Raw Normal View History

2024-05-21 20:38:30 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using BookshopDatabaseImplement.Models;
namespace BookshopDatabaseImplement
{
public class BookshopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-0CI5KVE\SQLEXPRESS;Initial Catalog=BookshopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Author> Authors { set; get; }
public virtual DbSet<Book> Books { set; get; }
public virtual DbSet<Genre> Genres { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Publisher> Publishers { set; get; }
public virtual DbSet<Review> Reviews { set; get; }
public virtual DbSet<User> Users { set; get; }
}
}