1

I created an Entity Framework file. My database is called MyDB. My Entity Framework file is MyDB.edmx and I used an existing connection string (MyDBConnectionString) to generate the edmx model.

It created two more connection strings:
MyDBEntities
MyDBContainer

What are these for? They look exactly the same and both have the information from my old connection string.

Do I still need my old connection string?

Update with more information:

Here are the connection strings:

<add name="MyDBConnectionString" connectionString="Data Source=localhost;Initial Catalog=MyDB;Persist Security Info=False;User ID=MyDB;Password=MyDB" providerName="System.Data.SqlClient" />
<add name="MyDBEntities" connectionString="metadata=res://*/App_Code.MyDB.csdl|res://*/App_Code.MyDB.ssdl|res://*/App_Code.MyDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=MyDB;Persist Security Info=True;User ID=MyDB;Password=MyDB;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
<add name="MyDBContainer" connectionString="metadata=res://*/App_Code.MyDB.csdl|res://*/App_Code.MyDB.ssdl|res://*/App_Code.MyDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=MyDB;Persist Security Info=True;User ID=MyDB;Password=MyDB;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

I created the first one called MyDBConnectionString. Then, when I generated the edmx model from the database visual studio created the MyDBEntities and MyDBContainer connection strings. What are the other two (Entities and Container) for? Do I not need the original connection string anymore?

1
  • Can you include them all? The EF has its own connection string, but (1) there's only one, and (2) it looks different than the DB CS. Commented Apr 22, 2010 at 12:59

1 Answer 1

2

You have three connectionStrings. Two are EF connectionStrings, one (MyDBConnectionString) is for ADO.NET.

You only need one of the EF connectionStrings. Keep the one which your model refers to. It will have the same name as the model itself.

You should probably keep MyDBConnectionString, too. If you want to use forms authentication, for example, you'll need that connectionString if you configure a SQL membership provider. They should both be kept in sync to point to the same DB.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks very much for the explaination.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.