Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 23, 2012 04:29 AM by Morteza Mousavi
Member
268 Points
141 Posts
Nov 22, 2012 02:52 PM|LINK
Hi there,
I am trying to learn mvc. I use Pluralsight training videos in this site(asp.net). In this video we created an DBContext Class called 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); } }
The problem is when i create a new object of this class:
OdeToFoodDb _db = new OdeToFoodDb();
I get following error:
iisexpress.exe - Assertion failed.
Expression: primitiveType != null
Description: Assertion failed: primitiveType != null Please help me
Thanks
All-Star
118619 Points
18779 Posts
Nov 23, 2012 03:24 AM|LINK
Morteza Mousavi public DbSet<Restaurant> Restaurants { get; set; } public DbSet<Review> Reviews { get; set; }
public DbSet<Restaurant> Restaurants { get; set; } public DbSet<Review> Reviews { get; set; }
Hi,
Can you give the full codes of your Restaurant as well as Review's codes?
And what's more——Your web.config, please.
Nov 23, 2012 04:29 AM|LINK
Hi Decker Dong-MSFT and thank you for your replay.
I just updated my Entity Framework version to 5.0.0 and it works fine!.
By the way i change a little in entity framework namespace. Because entity framework 5 had a little change in its namespaces.
Morteza Mous...
Member
268 Points
141 Posts
Error: iisexpress.exe - Assertion failed.
Nov 22, 2012 02:52 PM|LINK
Hi there,
I am trying to learn mvc. I use Pluralsight training videos in this site(asp.net). In this video we created an DBContext Class called 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); } }The problem is when i create a new object of this class:
I get following error:
iisexpress.exe - Assertion failed.
Expression: primitiveType != null
Description: Assertion failed: primitiveType != null
Please help me
Thanks
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Error: iisexpress.exe - Assertion failed.
Nov 23, 2012 03:24 AM|LINK
Hi,
Can you give the full codes of your Restaurant as well as Review's codes?
And what's more——Your web.config, please.
Morteza Mous...
Member
268 Points
141 Posts
Re: Error: iisexpress.exe - Assertion failed.
Nov 23, 2012 04:29 AM|LINK
Hi Decker Dong-MSFT and thank you for your replay.
I just updated my Entity Framework version to 5.0.0 and it works fine!.
By the way i change a little in entity framework namespace. Because entity framework 5 had a little change in its namespaces.