Cannot Generate Database from Entity Framework 4.1 Codefirst With SQL Server 2005 -



Cannot Generate Database from Entity Framework 4.1 Codefirst With SQL Server 2005 -

i seek create database entity framework code first follow tutorial

http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part4-cs

but utilize sql server 2005 instead when sqlexpress when execute solution don't have create. wrong code

this code.

movie.cs

public class film { public int id { get; set; } public string title { get; set; } public datetime releasedate { get; set; } public string genre { get; set; } public decimal cost { get; set; } } public class moviedbcontext : dbcontext { public dbset<movie> movies { get; set; } }

and connection string in web.config

<add name="moviedbcontext" connectionstring="data source=...;integrated security=sspi;initial catalog=moviedb;user id=...;password=..." providername="system.data.sqlclient" />

what wrong code? why database wasn't created.

thank every 1 help me.

the database not created until used first time. must of next trigger database creation:

create instance of context , retrieve or persist data create instance of context , phone call context.database.createifnotexists() create instance of context , phone call context.database.initialize(false) create instance of context , phone call context.database.create()

entity-framework entity-framework-4.1 code-first

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -