If you look on http://connectionstrings.com, unfortunately, you will not find sample connection strings for Entity Framework (either Database First or Code First).
Most developers that initially started working with Entity Framework, probably have been using Entity Framework Database First and therefore are familiar with the common lengthy connection string as follows:
However, the Entity Framework Code First connection strings follow the more standard ADO.NET model for database connection strings such as the following:
You can read more about the differences between the 2 Entity Framework models here: https://msdn.microsoft.com/en-us/data/jj556606%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396
Most developers that initially started working with Entity Framework, probably have been using Entity Framework Database First and therefore are familiar with the common lengthy connection string as follows:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<connectionStrings> | |
<add name="BlogContext" | |
connectionString="metadata=res://*/BloggingModel.csdl| | |
res://*/BloggingModel.ssdl| | |
res://*/BloggingModel.msl; | |
provider=System.Data.SqlClient | |
provider connection string= | |
"data source=(localdb)\v11.0; | |
initial catalog=Blogging; | |
integrated security=True; | |
multipleactiveresultsets=True;"" | |
providerName="System.Data.EntityClient" /> | |
</connectionStrings> |
However, the Entity Framework Code First connection strings follow the more standard ADO.NET model for database connection strings such as the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<connectionStrings> | |
<add name="BlogContext" | |
providerName="System.Data.SqlClient" | |
connectionString="Server=.\SQLEXPRESS;Database=Blogging;Integrated Security=True;"/> | |
</connectionStrings> |
You can read more about the differences between the 2 Entity Framework models here: https://msdn.microsoft.com/en-us/data/jj556606%28v=vs.113%29.aspx?f=255&MSPPError=-2147217396
No comments:
Post a Comment