26 lines
980 B
C#
26 lines
980 B
C#
using ElectronicsShopDataBaseImplement.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ElectronicsShopDataBaseImplement
|
|
{
|
|
public class Database : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder
|
|
optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
public virtual DbSet<CategoryProduct> CategoryProducts { set; get; }
|
|
public virtual DbSet<User> Users { set; get; }
|
|
public virtual DbSet<Role> Roles { set; get; }
|
|
public virtual DbSet<Product> Products { set; get; }
|
|
public virtual DbSet<Order> Orders { set; get; }
|
|
|
|
}
|
|
}
|