Trying to get my first MVC + EF code first project to run. The database does not yet exist. this is my connection string, and my model is named FirstDB:

<add name="FirstDB" 
     connectionString="Data Source=.; Initial Catalog=First; Integrated Security=SSPI; Provider=SQLNCLI10.1;" 
     providerName="System.Data.EntityClient"/>

The error I get says Data Source is not a recognized keyword.

http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

This is the guide I'm following, but unfortunately, they are using a sdf file, and all the other examples I've found are using a mdf file in user mode. I don't want to do either of those.

If it is non-trivial to see, my question is: How do I eliminate the error such that I can connect to the database server and have EF code first generate my database?

link|improve this question

68% accept rate
feedback

1 Answer

up vote 2 down vote accepted

You are using wrong provider. Code first doesn't use EntityClient. That is provider only for EF with EDMX mapping file. Use System.Data.SqlClient directly. You also don't need to specify Provider inside the connection string itself.

link|improve this answer
I would have never figured that out. – AaronLS Jul 11 '11 at 22:47
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.