public DatabaseTable Execute(CancellationToken ct, string tableName) { if (ct.IsCancellationRequested) { return(null); } var tables = _readerAdapter.Tables(tableName); if (tables.Count == 0) { return(null); } if (string.IsNullOrEmpty(_readerAdapter.Parameters.Owner)) { var owner = tables[0].SchemaOwner; Trace.WriteLine("Using first schema " + owner); _readerAdapter.Parameters.Owner = owner; } var columns = _readerAdapter.Columns(tableName); var identityColumns = _readerAdapter.IdentityColumns(tableName); var checkConstraints = _readerAdapter.CheckConstraints(tableName); var pks = _readerAdapter.PrimaryKeys(tableName); var uks = _readerAdapter.UniqueKeys(tableName); var fks = _readerAdapter.ForeignKeys(tableName); var dfs = _readerAdapter.DefaultConstraints(tableName); var triggers = _readerAdapter.Triggers(tableName); var tableDescs = _readerAdapter.TableDescriptions(tableName); var colDescs = _readerAdapter.ColumnDescriptions(tableName); var computed = _readerAdapter.ComputedColumns(tableName); var indexes = MergeIndexColumns(_readerAdapter.Indexes(tableName), _readerAdapter.IndexColumns(tableName)); var statistics = _readerAdapter.Statistics(tableName); if (columns.Count == 0) { return(null); } var table = new DatabaseTable { SchemaOwner = _readerAdapter.Parameters.Owner, Name = tableName }; table.Columns.AddRange(columns); UpdateCheckConstraints(table, checkConstraints); UpdateIdentities(table.Columns, identityColumns); UpdateComputed(table.Columns, computed); UpdateConstraints(table, pks, ConstraintType.PrimaryKey); UpdateConstraints(table, uks, ConstraintType.UniqueKey); UpdateConstraints(table, fks, ConstraintType.ForeignKey); UpdateConstraints(table, dfs, ConstraintType.Default); UpdateIndexes(table, indexes); UpdateStatistics(table, statistics); UpdateTriggers(table, triggers); UpdateTableDescriptions(table, tableDescs); UpdateColumnDescriptions(table, colDescs); _readerAdapter.PostProcessing(table); return(table); }