数据模型上下文:
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class ExampleEntities : DbContext
{
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Example1> Example1 { get; set; }
public virtual DbSet<Example2> Example { get; set; }
public virtual DbSet<Example3> Example3 { get; set; }
public virtual DbSet<Example4> Example4 { get; set; }
}
然后,当我尝试初始化上下文时,将其放在数据访问层文件中,
private ExampleEntities _context = new ExampleEntities();
抛出此异常。