/// <summary> /// Fills only the catalogs in the server object. /// </summary> /// <param name="server">The server to fill catalogs only.</param> /// <param name="connection">The open database connection to use.</param> /// <param name="metadataScriptFactory">The metadata script factory determined by the database type.</param> public static void Get( Server server, DbConnection connection, IMetadataScriptFactory metadataScriptFactory) { using (var command = connection.CreateCommand()) { command.CommandText = metadataScriptFactory.Catalogs(); using (var reader = command.ExecuteReader()) { if (!reader.HasRows) { reader.Close(); return; } Read(server, reader); reader.Close(); } } }
/// <summary> /// Fills only the catalogs in the server object. /// </summary> /// <param name="server">The server to fill catalogs only.</param> /// <param name="connection">The open database connection to use.</param> /// <param name="metadataScriptFactory">The metadata script factory determined by the database type.</param> /// <param name="cancellationToken">The optional cancellation token.</param> public static async Task GetAsync( Server server, DbConnection connection, IMetadataScriptFactory metadataScriptFactory, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); using (var command = connection.CreateCommand()) { command.CommandText = metadataScriptFactory.Catalogs(); using (var reader = await command.ExecuteReaderAsync(cancellationToken)) { if (!reader.HasRows) { reader.Close(); return; } await ReadAsync(server, reader, cancellationToken); reader.Close(); } } }