I’ve 3 different projects in one solution. I placed my connection string in first project like this
<connectionString name="My Connection String">
<parameters>
<parameter name="Integrated Security" value="True" />
<parameter name="server" value=".\SQLEXPRESS" isSensitive="true" />
<parameter name="database" value="MyDatabase" isSensitive="false" />
</parameters>
</connectionString>
Now in another project I make LINQ to SQL class and it generated app.config file and make it’s connection string in it? How can I make to read connection string from my exisiting .config file from another project?
I’m assuming you’re using Application Settings and have a connection string in your FirstProject.
Like this:
The generated Settings class is marked
internal sealed partial ..so you can’t directly access it viaMyProject.Properties.Settings...You just create a class to expose it:
Then use it from your second project like this: