Tortuga.Chain.PostgreSqlDataSource.CreateFromConfig C# (CSharp) Method

CreateFromConfig() public static method

Creates a new connection using the connection string in the app.config file.
public static CreateFromConfig ( string connectionName ) : PostgreSqlDataSource
connectionName string
return PostgreSqlDataSource
        public static PostgreSqlDataSource CreateFromConfig(string connectionName)
        {
            var settings = ConfigurationManager.ConnectionStrings[connectionName];
            if (settings == null)
                throw new InvalidOperationException("The configuration file does not contain a connection named " + connectionName);

            return new PostgreSqlDataSource(connectionName, settings.ConnectionString);
        }