20 lines
738 B
C#
20 lines
738 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using ShopDatabaseImplement.Models;
|
|
|
|
namespace ShopDatabaseImplement
|
|
{
|
|
public class ShopDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ShopDatabase;;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
public virtual DbSet<Customer> Customers { set; get; }
|
|
public virtual DbSet<ProductCategory> ProductCategorys { set; get; }
|
|
}
|
|
}
|