Reputation: 5866
I am trying to learn mvc3/4 by trying to build my current project. How do you set the connection string for enterprise library? I have downloaded the libraries and added as reference. But I dont know how to set the connection string.
this is what I have now...
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=UpdatedProducts;User ID=myUsername;Password=myPassword;AttachDBFilename=|DataDirectory|\aspnet-GuncelMalzemeler-20130430221215.mdf" />
do you guys have any idea how to set this connection?
Upvotes: 0
Views: 478
Reputation: 3612
It's like this:
<configuration>
<configSections>
<section name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0,
Culture=neutral, PublicKeyToken=null"
requirePermission="false"/>
</configSections>
<dataConfiguration defaultDatabase="DefaultConnection" />
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=UpdatedProducts;User ID=myUsername;Password=myPassword;AttachDBFilename=|DataDirectory|\aspnet-GuncelMalzemeler-20130430221215.mdf" />
</connectionStrings>
</configuration>
You may need to change the section type attribute based on the version of the enterprise library you are using.
Upvotes: 1