/// <summary> /// Gets the table. If <see cref="Owner" /> is specified, it is used. /// </summary> /// <param name="tableName">Name of the table. Oracle names can be case sensitive.</param> /// <param name="ct">The ct.</param> public DatabaseTable Table(string tableName, CancellationToken ct) { if (string.IsNullOrEmpty(tableName)) throw new ArgumentNullException("tableName"); DatabaseTable table; using (_readerAdapter.CreateConnection()) { var builder = new TableBuilder(_readerAdapter); var handler = ReaderProgress; if (handler != null) builder.ReaderProgress += RaiseReadingProgress; table = builder.Execute(ct, tableName); } var existingTable = DatabaseSchema.FindTableByName(tableName, _schemaParameters.Owner); if (existingTable != null) { DatabaseSchema.Tables.Remove(existingTable); } DatabaseSchema.Tables.Add(table); if (ct.IsCancellationRequested) return table; if (DatabaseSchema.DataTypes.Count > 0) DatabaseSchemaFixer.UpdateDataTypes(DatabaseSchema); return table; }
/// <summary> /// Gets all tables (plus constraints, indexes and triggers). /// </summary> public IList<DatabaseTable> AllTables(CancellationToken ct) { if (ct.IsCancellationRequested) return new List<DatabaseTable>(); RaiseReadingProgress(SchemaObjectType.Tables); IList<DatabaseTable> tables; using (_readerAdapter.CreateConnection()) { var builder = new TableBuilder(_readerAdapter); tables = builder.Execute(ct); } if (ct.IsCancellationRequested) return tables; DatabaseSchema.Tables.Clear(); DatabaseSchema.Tables.AddRange(tables); UpdateReferences(); if (DatabaseSchema.DataTypes.Count > 0) DatabaseSchemaFixer.UpdateDataTypes(DatabaseSchema); return tables; }