我正在尝试学习mvc。我在此站点(asp.net)中使用Pluralsight培训视频。
在此视频中,我们创建了一个名为DBContextOdeToFoodDb类:

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


如何避免此错误?

最佳答案

尝试将EntityFramework更新到最新版本,或将.NET4用于您的项目。

This blog post might be related.

关于c# - 错误:iisexpress.exe-断言失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13516420/

10-13 03:18