private Schema ExtractSchema(SqlConnection connection, string databaseName, string schemaName) { var task = new SqlExtractionTask(databaseName, schemaName); return(Extract(connection, new[] { task }) .Catalogs[databaseName].Schemas.FirstOrDefault(el => el.Name == schemaName)); }
/// <summary> /// Extracts all schemas from the database. /// </summary> /// <param name="connection">The connection.</param> /// <returns> /// <see cref="Catalog"/> that holds all schemas in the database. /// </returns> public Catalog ExtractCatalog(SqlConnection connection) { var defaultSchema = GetDefaultSchema(connection); var task = new SqlExtractionTask(defaultSchema.Database); return(Extract(connection, new[] { task }).Catalogs.Single()); }
private async Task <Schema> ExtractSchemaAsync(SqlConnection connection, string databaseName, string schemaName, CancellationToken token = default) { var task = new SqlExtractionTask(databaseName, schemaName); return((await ExtractAsync(connection, new[] { task }, token).ConfigureAwait(false)) .Catalogs[databaseName].Schemas.FirstOrDefault(el => el.Name == schemaName)); }
/// <summary> /// Asynchronously extracts all schemas from the database. /// </summary> /// <remarks> Multiple active operations are not supported. Use <see langword="await"/> /// to ensure that all asynchronous operations have completed.</remarks> /// <param name="connection">The connection.</param> /// <param name="token">The token to cancel asynchronous operation if needed.</param> /// <returns> /// <see cref="Catalog"/> that holds all schemas in the database. /// </returns> public async Task <Catalog> ExtractCatalogAsync(SqlConnection connection, CancellationToken token = default) { var defaultSchema = await GetDefaultSchemaAsync(connection, token).ConfigureAwait(false); var task = new SqlExtractionTask(defaultSchema.Database); return((await ExtractAsync(connection, new[] { task }, token).ConfigureAwait(false)).Catalogs.Single()); }