Entity Framework Code First with SQL ServerPosted: July 26, 2011
As you know EF 4.1 Code First can create tables out of the model classes. If connection string is not provided in the config file, EF looks for local Sql express instance. If available, it connects to the instance and creates Database with table names same as your model classes.
But, what if you have a local SQL server instance instead of SQLExpress or your instance name is not SQLExpress? EF won’t connect automatically to the Instance in either of these cases,unless you explicitly provide your connection string. How can you use the local SQL Instance without specifiying the connection string?
It is possible. Here is where we need to see what exactly EF looks for connecting to a SQL instance. To be precise EF looks for .\SQLExpress instance in your local system. To make EF connect to any SQL instance just create an alias named “.\SQLExpress” for your SQL Instance. This can be done via SQL Server Configuration Manager tool as shown below.
Now EF connects to the SQL instance just fine as if it were local .\SQLExpress instance.