27 lines
762 B
C#
27 lines
762 B
C#
|
using DatabaseImplement.Models;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace DatabaseImplement
|
|||
|
{
|
|||
|
public class COPcontext: DbContext
|
|||
|
{
|
|||
|
protected override void OnConfiguring(DbContextOptionsBuilder
|
|||
|
optionsBuilder)
|
|||
|
{
|
|||
|
if (optionsBuilder.IsConfigured == false)
|
|||
|
{
|
|||
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-ON2V3BB\SQLEXPRESS;Initial Catalog=COPDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
|||
|
}
|
|||
|
base.OnConfiguring(optionsBuilder);
|
|||
|
}
|
|||
|
public virtual DbSet<Book> Books { set; get; }
|
|||
|
public virtual DbSet<Shape> Shapes { set; get; }
|
|||
|
}
|
|||
|
}
|