Uncas.Core by Ole Lynge Soerensen

<PackageReference Include="Uncas.Core" Version="1.1.0.154" />

 ConfigurationWrapper

public static class ConfigurationWrapper
Wraps configuration.
using System; using System.Configuration; namespace Uncas.Core { public static class ConfigurationWrapper { public static string GetConnectionString(string connectionStringName) { ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionStringName]; if (connectionStringSettings == null) throw new ArgumentException("No connection string with the name " + connectionStringName, "connectionStringName"); return connectionStringSettings.ConnectionString; } public static string GetConnectionString(string connectionStringName, string defaultValue) { ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionStringName]; if (connectionStringSettings == null) return defaultValue; return connectionStringSettings.ConnectionString; } } }