Class SqlServerDatabaseLister
- Namespace
- ItTiger.TigerQuery.Core
- Assembly
- ItTiger.TigerQuery.Core.dll
Lists the databases available on the server described by a connection profile.
Used to back interactive database selection. Failures (unreachable server,
bad credentials, etc.) are swallowed and surface as an empty list so an
optional prompt is simply skipped rather than aborting the command.
public static class SqlServerDatabaseLister
- Inheritance
-
SqlServerDatabaseLister
- Inherited Members
Methods
ListAsync(SqlServerConnectionProfile, CancellationToken)
Lists accessible online databases for a profile's server and credentials.
public static Task<IReadOnlyList<string>> ListAsync(SqlServerConnectionProfile profile, CancellationToken cancellationToken = default)
Parameters
profileSqlServerConnectionProfile- The connection profile. Its initial database is ignored for the probe.
cancellationTokenCancellationToken- A token passed to connection and query operations.
Returns
- Task<IReadOnlyList<string>>
- Accessible database names ordered by SQL Server, or an empty list for any non-cancellation connection, credential, permission, or query failure.
Remarks
A five-second connection timeout is used when the profile does not specify
one. The profile itself is not modified.
Exceptions
- ArgumentNullException
profileis null.- OperationCanceledException
cancellationTokenis cancelled.