Inheritance: WebApplications.Utilities.Configuration.ConfigurationElement
Exemple #1
0
        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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }