コード例 #1
0
ファイル: SqlDriver.cs プロジェクト: lanicon/dataobjects-net
        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));
        }
コード例 #2
0
ファイル: SqlDriver.cs プロジェクト: lanicon/dataobjects-net
        /// <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());
        }
コード例 #3
0
ファイル: SqlDriver.cs プロジェクト: lanicon/dataobjects-net
        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));
        }
コード例 #4
0
ファイル: SqlDriver.cs プロジェクト: lanicon/dataobjects-net
        /// <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());
        }