示例#1
0
        /// <summary>
        /// Asynchronously runs a database connection test.
        /// </summary>
        /// <param name="databaseConnectionTestDetails">Details of the database connection test
        /// to be run.</param>
        /// <param name="cancellationToken">Required to support cancellation of asnychronous task.</param>
        /// <returns>DatabaseConnectionTestDetails updated with test results.</returns>
        public async Task <DatabaseConnectionTestDetails> RunAsync(
            DatabaseConnectionTestDetails databaseConnectionTestDetails,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Task connectionTask = Task.Factory.StartNew(() =>
                                                        Run(databaseConnectionTestDetails), cancellationToken);
            await connectionTask;

            return(databaseConnectionTestDetails);
        }
示例#2
0
 /// <summary>
 /// This method should be overridden to utilize the IDatabaseConnectionCheckerFactory
 /// provided in the constructor to execute the appropriate database connection test,
 /// and update the provided databaseConnectionTestDetails object according to the test
 /// results.
 /// </summary>
 /// <param name="databaseConnectionTestDetails">Provides details about the database connection
 /// under test, and records details of any executed test.</param>
 protected abstract void Run(DatabaseConnectionTestDetails databaseConnectionTestDetails);