CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopDataBaseImplement/DataBase.cs

28 lines
1.0 KiB
C#
Raw Normal View History

2024-04-28 23:08:09 +04:00
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
namespace ElectronicsShopDataBaseImplement
{
public class DataBase
{
public class Database : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder
optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=ZooDatabase;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<Route> Routes { set; get; }
public virtual DbSet<RoutePreserve> RoutePreserves { set; get; }
public virtual DbSet<Preserve> Preserves { set; get; }
}
}
}