entity framework - EF Code First CTP 5 and SQL SErver 2008 R2 -


i can't seem ef code first work sql server 2008 r2. error getting "invalid object name 'dbo.movies'."

it not creating table automatically.

my connection string:

<add name="moviedbcontext" connectionstring="server=(local); database=movies; trusted_connection=true; integrated security=true" providername="system.data.sqlclient" />

my model , context class:

public class movie {     public int id { get; set; }      [required(errormessage = "title required")]     public string title { get; set; }      [required(errormessage = "date required")]     public datetime releasedate { get; set; }      [required(errormessage = "genre must specified")]     public string genre { get; set; }      [required(errormessage = "price required")]     [range(1, 100, errormessage = "price must between $1 , $100")]     public decimal price { get; set; }      [stringlength(5)]     public string rating { get; set; }  }  public class moviedbcontext : dbcontext {     public dbset<movie> movies { get; set; }      protected override void onmodelcreating(modelbuilder modelbuilder)     {         modelbuilder.entity<movie>().property(p => p.price).hasprecision(18, 2);     } } 

any appreciated.

i forget if it's enabled default try setting in application_start (pretty sure it's not)

system.data.entity.database.dbdatabase.setinitializer<moviedbcontext>(new createdatabaseifnotexists<moviedbcontext>()); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -