CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs
Илья Федотов f7bad7a0bf fix
2024-06-01 03:37:37 +04:00

29 lines
1.1 KiB
C#

using ElectronicsShopDataBaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace ElectronicsShopDataBaseImplement
{
public class Database : DbContext
{
//DESKTOP-E2VPEN3
//DESKTOP-O0N00SH
protected override void OnConfiguring(DbContextOptionsBuilder
optionsBuilder)
{
if (optionsBuilder.IsConfigured == false) {
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Product> Products { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<OrderProduct> OrderProducts { set; get; }
public virtual DbSet<Employee> Employees { set; get; }
public virtual DbSet<CostItem> CostItems { set; get; }
public virtual DbSet<Paymeant> Paymeants { get; set; }
public virtual DbSet<MessageInfo> Messages { set; get; }
}
}