Keyword not supported: “data source” initializing Entity Framework Context

后端 未结 6 878
梦毁少年i
梦毁少年i 2020-11-30 23:38

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

metadata=res://*/MainDB.csdl|res://*/MainDB.ssdl|res://*/

相关标签:
6条回答
  • 2020-11-30 23:44

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

    0 讨论(0)
  • 2020-11-30 23:54

    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" />
    
    0 讨论(0)
  • 2020-11-30 23:57

    The real reason you were getting this error is because of the &quot; values in your connection string.

    If you replace those with single quotes then it will work fine.

    https://docs.microsoft.com/archive/blogs/rickandy/explicit-connection-string-for-ef

    (Posted so others can get the fix faster than I did.)

    0 讨论(0)
  • 2020-11-30 23:58

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

    0 讨论(0)
  • 2020-12-01 00:02

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

    0 讨论(0)
  • 2020-12-01 00:11

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

    0 讨论(0)
提交回复
热议问题