PIbd-31_PotapovNS_COP_20/InternetShop/InternetShopDatabase/InternetShopDatabase.cs

20 lines
756 B
C#

using InternetShopDatabase.Models;
using Microsoft.EntityFrameworkCore;
namespace InternetShopDatabase
{
public class InternetShopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=localhost;User Id=SA;Password=87cbn9y48392nu32;Initial Catalog=InternetShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Product> Products { set; get; }
}
}