Reputation: 33
i write a program with mvc and entity framework. i have problem with connection string.
my host say your connection string must be like follow:
Server=sql2005.yourdomain.com,1430;Database=databaseName;Uid=userName;Password=password;
and connection string in my program is:
<add name="sbiEntities" connectionString="metadata=res://*/Models.modelCompany.csdl|res://*/Models.modelCompany.ssdl|res://*/Models.modelCompany.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|\sbi.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
how change it?
Upvotes: 1
Views: 240
Reputation: 1537
An EF connection string is divided into several parts divided by a semicolon (;).
The first part is the model metadata, this is autogenerated from your edmx file.
The second part is the provider EF should use to communicate with your storage.
The third part is the provider connection string which is your current connection string (line wrapped for readability):
...provider connection string="
data source=(LocalDB)\v11.0;
attachdbfilename=|DataDirectory|\sbi.mdf;
integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"
The text between the two "
is your current connection string and is the one that should be replaced. Be aware to keep the MultipleActiveResultSets=True, and switch the App=EntityFramework with an application name that reflects your application for easier diagnostic.
Upvotes: 1
Reputation: 544
Entity Framework having a special type of connection string which have CSDL, SSDL, MSL and your original connection string.
Conceptual schema definition language (CSDL): This section describe your conceptual model of EDMX file.
Storage schema definition language (SSDL): This section describe the database schema model of EDMX file.
Mapping specification language (MSL): This section is for the mappings of the two world (CSDL and SSDL).
EF actually get the CSDL, SSDL and MSL file names from the connection string.
Upvotes: 1