Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type or namespace of 'ModelBuilder' cannot be found (are you missing a using directive or assembly reference?)

In step 7 of the ASP.MVC 3 Tutorial, it introduces the 'ModelBuilder' type. I'm using ASP.Net 4, MVC 3, and EF 4.1, and I get the red squiggly lines under the 'ModelBuilder' type. It can't find the type. Has that type name changed? What reference should I add to use it?

using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
...

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Movie>().Property(p => p.Price).HasPrecision(18, 2);
    }
like image 500
Dan Sorensen Avatar asked Mar 27 '11 16:03

Dan Sorensen


1 Answers

The name changed from CTP5 to EF 4.1. This thing is now called DbModelBuilder.

like image 152
Slauma Avatar answered Oct 19 '22 22:10

Slauma