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

20 lines
701 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=tcp:127.0.0.1;Initial Catalog=internetShopBase;User ID=SA;Password=87cbn9y48392nu32;TrustServerCertificate=true;");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Product> Products { set; get; }
}
}