public Task <LoadBalancedConnection> GetConnection(
[NotNull] string database,
[CanBeNull] string connectionName = null,
[CanBeNull] bool?ensureIdentical = null,
CancellationToken cancellationToken = default(CancellationToken))
{
if (database == null)
{
throw new ArgumentNullException("database");
}
DatabaseElement db = Databases[database];
if ((db == null) ||
(!db.Enabled))
{
return(TaskResult <LoadBalancedConnection> .FromException(
new LoggingException(
() => Resources.DatabaseConfiguration_GetSqlProgram_DatabaseIdNotFound,
database)));
}
return(db.GetConnection(connectionName, ensureIdentical, cancellationToken));
}