Answers for ".net using appsettings variables"

C#
0

.net using appsettings variables

var connectionString = ConfigurationManager.ConnectionStrings["Default"].ConnectionString;
connectionString.Expand() // returns "server=db01.mycompany.com;uid=uid;pwd=pwd;Initial Catalog=master;"
Posted by: Guest on January-05-2021
0

.net using appsettings variables

<configuration>
    <appSettings>
        <add key="Domain" value="mycompany.com"/>
        <add key="ServerName" value="db01.{Domain}"/>
    </appSettings>
    <connectionStrings>
        <add name="Default" connectionString="server={ServerName};uid=uid;pwd=pwd;Initial Catalog=master;" provider="System.Data.SqlClient" />
    </connectionStrings>
</configuration>
Posted by: Guest on January-05-2021

Code answers related to ".net using appsettings variables"

C# Answers by Framework

Browse Popular Code Answers by Language