How to Connect to SQL Server 2008 R2 Using EF and MVC 3
This has taken me all day to figure out and the errors that i have been getting back all suggested that there was a connection problem to the server. As it turns out you need to add a reference to your dabase connection in the model context file, it was so simple in the end it was stupid, but it is amazing how hard it was to find the answer.
//-- Add the name of your database connection to the base DbContext
public MvcMusicStoreContext(): base("ConectionStringName"){}
as long as this matches what is in your web.config file connection to
the database should be made.below is a link to the webpage that sorted things for me.
how-to-connect-to-sql-server-2008-r2-using-ef-and-mvc-3