Using EF 4.1 Code First without SQL Express

I began following Julie Lerman’s excellent tutorials on getting started with Entity Framework (EF) version 4.1 and the Code First technique of generated databases on the MSDN web site.  However, the defaults for Code First expect you to have SQL Server Express installed for the examples to work.  I was able to get EF Code First to work with SQL Server (not Express) by adding the following connection string to my web.config file:

Just make sure that the name, e.g. BlogContext, matches the name of the class derived from DbContext.  Note that you will also likely need to replace the “.” in “Server=.” with whatever your server name is.  The “.” is just a reference to the SQL Server running on your local machine.

Rob