我正在尝试学习 mvc。我在此站点 (asp.net) 中使用 Pluralsight 培训视频。
在本视频中,我们创建了一个DBContext
名为OdeToFoodDb
:
public class OdeToFoodDb: DbContext
{
public DbSet<Restaurant> Restaurants { get; set; }
public DbSet<Review> Reviews { get; set; }
protected override void OnModelCreating(System.Data.Entity.ModelConfiguration.ModelBuilder modelBuilder)
{
modelBuilder.Entity<Restaurant>()
.HasMany(resturant => resturant.Reviews)
.WithRequired(review => review.Resturant);
base.OnModelCreating(modelBuilder);
}
}
问题是当我创建这个类的新对象时:
OdeToFoodDb _db = new OdeToFoodDb();
我收到以下错误:
iisexpress.exe - Assertion failed.
Expression: primitiveType != null
Description: Assertion failed: primitiveType != null
我怎样才能避免这个错误?