Class Database

Represents a Microsoft SQL Server database.

Inheritance
System.Object
Database
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.BusinessFoundation.Data.Sql.Management
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 10.8.0
Syntax
public class Database

Constructors

Database()

Initializes a new instance of the Database class.

Declaration
public Database()

Database(String)

Initializes a new instance of the Database class.

Declaration
public Database(string name)
Parameters
Type Name Description
System.String name

The name.

Properties

ActiveDbName

Gets the name of the active db.

Declaration
public static string ActiveDbName { get; }
Property Value
Type Description
System.String

The name of the active db.

Name

Gets the name.

Declaration
public string Name { get; }
Property Value
Type Description
System.String

The name.

Relations

Declaration
public RelationCollection Relations { get; }
Property Value
Type Description
RelationCollection

Tables

Gets the tables.

Declaration
public TableCollection Tables { get; }
Property Value
Type Description
TableCollection

The tables.

Methods

CreateRelation(Table, Table, String)

Creates the relation.

Declaration
public Relationship CreateRelation(Table primaryTable, Table foreignTable, string foreignColumn)
Parameters
Type Name Description
Table primaryTable

The primary table.

Table foreignTable

The foreign table.

System.String foreignColumn

The foreign column.

Returns
Type Description
Relationship

CreateRelation(Table, Table, String, Boolean)

Creates the relation.

Declaration
public Relationship CreateRelation(Table primaryTable, Table foreignTable, string foreignColumn, bool cascadeDelete)
Parameters
Type Name Description
Table primaryTable

The primary table.

Table foreignTable

The foreign table.

System.String foreignColumn

The foreign column.

System.Boolean cascadeDelete

if set to true [cascade delete].

Returns
Type Description
Relationship

CreateTable(String, Column[])

Creates the table.

Declaration
public Table CreateTable(string tableName, params Column[] columns)
Parameters
Type Name Description
System.String tableName

Name of the table.

Column[] columns

The columns.

Returns
Type Description
Table

DropRelation(Relationship)

Declaration
public void DropRelation(Relationship relation)
Parameters
Type Name Description
Relationship relation

DropTable(Table)

Drops the table.

Declaration
public void DropTable(Table table)
Parameters
Type Name Description
Table table

The table.

ExecuteTableSPCleanScript(Table)

Executes the table SP clean script.

Declaration
public static void ExecuteTableSPCleanScript(Table table)
Parameters
Type Name Description
Table table

The table.

ExecuteTableSPCleanScript(Table, Table[])

Executes the table SP clean script.

Declaration
public static void ExecuteTableSPCleanScript(Table table, params Table[] extended)
Parameters
Type Name Description
Table table

The table.

Table[] extended

The extended.

ExecuteTableSPCreateScript(Table)

Executes the table SP create script.

Declaration
public static void ExecuteTableSPCreateScript(Table table)
Parameters
Type Name Description
Table table

The table.

ExecuteTableSPCreateScript(TableConfig)

Executes the table SP create script.

Declaration
public static void ExecuteTableSPCreateScript(TableConfig tableConfig)
Parameters
Type Name Description
TableConfig tableConfig

The table configuration.

FillRelations(TableCollection, RelationCollection)

Fills the relations.

Declaration
protected static void FillRelations(TableCollection tables, RelationCollection relations)
Parameters
Type Name Description
TableCollection tables

The tables.

RelationCollection relations

The relations.

FillTables(Database, TableCollection)

Fills the tables.

Declaration
protected static void FillTables(Database database, TableCollection tables)
Parameters
Type Name Description
Database database

The database.

TableCollection tables

The tables.

GenerateCreateTableScript(String, Column[])

Gets the active.

Declaration
public static string GenerateCreateTableScript(string tableName, params Column[] columns)
Parameters
Type Name Description
System.String tableName

Name of the table.

Column[] columns

The columns.

Returns
Type Description
System.String

GenerateTableSPCleanScript(Table)

Generates the table SP clean script.

Declaration
public static string GenerateTableSPCleanScript(Table table)
Parameters
Type Name Description
Table table

The table.

Returns
Type Description
System.String

GenerateTableSPCreateScript(Table)

Generates the table SP create script.

Declaration
public static string GenerateTableSPCreateScript(Table table)
Parameters
Type Name Description
Table table

The table.

Returns
Type Description
System.String

GenerateTableSPCreateScript(TableConfig)

Generates the table SP create script.

Declaration
public static string GenerateTableSPCreateScript(TableConfig tableConfig)
Parameters
Type Name Description
TableConfig tableConfig

The table configuration.

Returns
Type Description
System.String