what is the connectionstring format in your "via a constructor that accepts a string"

edited April 2013
I have a question about your lingpad connection.

1.I click add Connection in your linqpad.
2.choose Entity Framework DBContext(4.1/4.2/5.0)
3.click next then choose path to customerAssembly in my case Q6MVCEFDataLayer.dll
4.then popupscreen for me to choose DbContext I choose my DBcontext

because In my DBContext C# code. I passed connectionstring to Constructor.

namespace Q6MVCEFDataLayer
public class AccountingModelContext : System.Data.Entity.DbContext
public AccountingModelContext(string connectionString)
: base(connectionString)

5. So in your "via a constructor that accepts a string" Textbox, I input the connectionsring's Value

"metadata=res://*/AccountingModel.csdl|res://*/AccountingModel.ssdl|res://*/AccountingModel.msl;provider=System.Data.SqlClient;provider connection string="data source=;initial catalog=0000001-00293D54-5E72-447C-A2F5-082C59C14DCD;user id=sa;password=xxx;MultipleActiveResultSets=True;App=EntityFramework""

6. then I click your "test" button to test. it got a Error message" Error:Keyword not supported:"metadata' .

this Connectionstring is I copied from my visual studio. it work fine in visual studio.
db = new AccountingModelContext(connectionString);

so Can you provide a sample connection string ,which will work here?



  • Here's a sample connection string that works for me:

    metadata=res://*/ModelFirst.csdl|res://*/ModelFirst.ssdl|res://*/ModelFirst.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=Nutshell;Integrated Security=True;MultipleActiveResultSets=True"

    P.S. I've edited your message to remove the sa password from your connection string.
  • hi,Joe:
    why i need to use "metadata=res://*/ModelFirst.csdl|res://*/ModelFirst.ssdl|res://*/ModelFirst.msl;"

    why i could not use the same metadata that I used in visual studio?
  • What I showed you was a sample that works for me - of course, you'll need to change it.
Sign In or Register to comment.