public Task <SqlProgram> GetSqlProgram( [NotNull] string database, [NotNull] string name, [CanBeNull] IEnumerable <KeyValuePair <string, Type> > parameters = null, bool ignoreValidationErrors = false, bool checkOrder = false, TimeSpan?defaultCommandTimeout = null, TypeConstraintMode?constraintMode = null, CancellationToken cancellationToken = default(CancellationToken)) { if (database == null) { throw new ArgumentNullException("database"); } if (name == null) { throw new ArgumentNullException("name"); } // We have to find the database otherwise we cannot get a load balanced connection. DatabaseElement db = Databases[database]; if ((db == null) || (!db.Enabled)) { return(TaskResult <SqlProgram> .FromException( new LoggingException( () => Resources.DatabaseConfiguration_GetSqlProgram_DatabaseIdNotFound, database))); } return(db.GetSqlProgram( name, parameters, ignoreValidationErrors, checkOrder, defaultCommandTimeout, constraintMode, cancellationToken)); }
public Task <IEnumerable <LoadBalancedConnection> > GetConnections( [NotNull] string database, [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 <IEnumerable <LoadBalancedConnection> > .FromException( new LoggingException( () => Resources.DatabaseConfiguration_GetSqlProgram_DatabaseIdNotFound, database))); } return(db.GetConnections(ensureIdentical, cancellationToken)); }
public Task <DatabaseSchema> GetSchema( [NotNull] string database, [CanBeNull] string connectionName = null, bool forceReload = false, CancellationToken cancellationToken = default(CancellationToken)) { if (database == null) { throw new ArgumentNullException("database"); } DatabaseElement db = Databases[database]; if ((db == null) || (!db.Enabled)) { return(TaskResult <DatabaseSchema> .FromException( new LoggingException( () => Resources.DatabaseConfiguration_GetSqlProgram_DatabaseIdNotFound, database))); } return(db.GetSchema(connectionName, forceReload, cancellationToken)); }