Class DatabaseSchema
- Namespace
- Dynamicweb.Data
- Assembly
- Dynamicweb.Core.dll
Provides methods for reading database layouts from connections. Can provide information on tables and their columns.
public sealed class DatabaseSchema
- Inheritance
-
DatabaseSchema
- Inherited Members
Constructors
DatabaseSchema()
Initializes a new instance of the DatabaseSchema class.
public DatabaseSchema()
Methods
AddColumns(string, IEnumerable<ColumnInfo>)
Adds new columns to the specified table.
public static ApplicationResponse AddColumns(string tableName, IEnumerable<ColumnInfo> columns)
Parameters
tableName
stringName of the table.
columns
IEnumerable<ColumnInfo>The columns.
Returns
Remarks
Does not merge/alter existing tables
GetTableColumns(IDbConnection, string)
Gets the table columns.
public DataTable? GetTableColumns(IDbConnection connection, string tableName)
Parameters
connection
IDbConnectionA database connection.
tableName
stringName of the table to get columns from.
Returns
- DataTable
A DataTable with the schema table of the tableName. Column names and DbTypes.
Remarks
Closes and disposes the connection.
GetTables()
Gets the tables in the database on the passed connection.
public DataTable? GetTables()
Returns
- DataTable
A DataTable with the schema table of the connection. Contains table names.
Remarks
Closes and disposes the connection.
GetTables(IDbConnection)
Gets the tables in the database on the passed connection.
public DataTable? GetTables(IDbConnection connection)
Parameters
connection
IDbConnectionA database connection of SqlConnection. Can be obtained using CreateConnection().
Returns
- DataTable
A DataTable with the schema table of the connection. Contains table names.
Remarks
Closes and disposes the connection.
GetTables(SqlConnection)
Gets the tables in the database on the passed connection.
public DataTable? GetTables(SqlConnection connection)
Parameters
connection
SqlConnectionA database connection.
Returns
- DataTable
A DataTable with the schema table of the connection. Contains table names.
Remarks
Closes and disposes the connection.