[entity-framework] Keyword not supported: "data source" initializing Entity Framework Context

I'm initializing Entity Framework Object context, and this gives me the keyword not supported error:

metadata=res://*/MainDB.csdl|res://*/MainDB.ssdl|res://*/MainDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Workspace\vs\Leftouch\Leftouch.Web\Data\Leftouch.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;App=EntityFramework"

I took the connection string directly from web.config which was working, and modified only the path to the file (which I set dynamically), and instead of using the default value, used this connection string explicitly. What could cause this error?

This question is related to entity-framework connection-string

The answer is


Make sure you have Data Source and not DataSource in your connection string. The space is important. Trust me. I'm an idiot.


I fixed this by changing EntityClient back to SqlClient, even though I was using Entity Framework.

So my complete connection string was in the format:

<add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=xxx;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient" />

Just use \" instead ", it should resolve the issue.


Believe it or not, renaming LinqPad.exe.config to LinqPad.config solved this problem.


This appears to be missing the providerName="System.Data.EntityClient" bit. Sure you got the whole thing?