Coursework_ComputerStore_Li.../ComputerStoreDatabaseImplement/ComputerStoreDatabase.cs

30 lines
1.1 KiB
C#
Raw Normal View History

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(@"Server=localhost\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<ConsignmentComponent> ConsignmentComponents { get; set; }
}
}