Coursework_ComputerStore_Li.../ComputerStoreDatabaseImplement/ComputerStoreDatabase.cs

35 lines
1.4 KiB
C#

using ComputerStoreDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerStoreDatabaseImplement
{
public class ComputerStoreDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=YUEEJKE\SQLEXPRESS;Initial Catalog=ComputerStoreDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Component> Components { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<PC> PCS { get; set; }
public virtual DbSet<Employee> Employees { get; set; }
public virtual DbSet<RequestComponent> RequestComponents { get; set; }
public virtual DbSet<ProductComponent> ProductComponents { get; set; }
public virtual DbSet<ConsignmentProduct> ConsignmentProducts { get; set; }
public virtual DbSet<Consignment> Consignments { get; set; }
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Request> Requests { get; set; }
public virtual DbSet<Seller> Sellers { get; set; }
}
}