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.
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?
You are using wrong provider. Code first doesn’t use
EntityClient. That is provider only for EF with EDMX mapping file. UseSystem.Data.SqlClientdirectly. You also don’t need to specifyProviderinside the connection string itself.