SqlServerSchemaProvisioner

Implements an ISchemaProvisioner for Microsoft SQL server.

Namespace:
KpokPatagon.Data.SqlServer.DatabaseSchema
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
No

Methods

AddColumn

Adds a column to a table.

Signature:
public Void AddColumn(table, column)
Parameters
Name Type Summary
table Table Table to be altered.
column TableColumn Column to be added.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- column is null.

ValidationException Thrown when the configuration is not valid.

AddColumnConstraint

Adds a column constraint.

Signature:
public Void AddColumnConstraint(table, column, constraint)
Parameters
Name Type Summary
table Table Table to be alter.
column TableColumn Column to be alter.
constraint ColumnConstraint Contraint to be added.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- column is null.

-or- constraint is null.

ValidationException Thrown when the configuration is not valid.

AddForeignKey

Adds a foreign key to table.

Signature:
public Void AddForeignKey(table, foreignKey)
Parameters
Name Type Summary
table Table Table to be alter.
foreignKey ForeignKey Foreign key to be added.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- foreignKey is null.

ValidationException Thrown when the configuration is not valid.

AlterColumn

Modifies a table column.

Signature:
public Void AlterColumn(table, from, to)
Parameters
Name Type Summary
table Table Table to be alter.
from TableColumn The actual configuration of the column.
to TableColumn The desired configuration of the column.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- from is null.

-or- to is null.

ValidationException Thrown when the configuration is not valid.

CreateIndex

Creates an index.

Signature:
public Void CreateIndex(table, index)
Parameters
Name Type Summary
table Table Table to be alter.
index Index Index to be created.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- index is null.

ValidationException Thrown when the configuration is not valid.

CreatePrimaryKey

Creates a primary key for the table.

Signature:
public Void CreatePrimaryKey(table, primaryKey)
Parameters
Name Type Summary
table Table Table to be alter.
primaryKey Index Primary key to be created.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- primaryKey is null.

ValidationException Thrown when the configuration is not valid.

CreateSchema

Creates a schema.

Signature:
public Void CreateSchema(name)
Parameters
Name Type Summary
name String The name of the schema to create.

CreateSequenceIfNotExists

Creates a sequence if it does not exists.

Signature:
public Void CreateSequenceIfNotExists(sequence)
Remarks

Sql Server does not support sequences so this method does nothing.

Parameters
Name Type Summary
sequence Sequence A sequence to be created.

CreateTable

Creates a table.

Signature:
public Void CreateTable(table)
Parameters
Name Type Summary
table Table Table to be created.
Exceptions
Type Summary
ArgumentNullException Thrown when table is null.
ValidationException Thrown when the configuration is not valid.

CreateView

Creates a view.

Signature:
public Void CreateView(view)
Parameters
Name Type Summary
view View View to be created.
Exceptions
Type Summary
ArgumentNullException Thrown when view is null.
ValidationException Thrown when the configuration is not valid.

DropColumn

Drops a column from the table.

Signature:
public Void DropColumn(table, column)
Parameters
Name Type Summary
table Table Table to alter.
column TableColumn Column to be dropped.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- column is null.

ValidationException Thrown when the configuration is not valid.

DropColumnConstraint

Drops a column constraint.

Signature:
public Void DropColumnConstraint(table, column, constraint)
Parameters
Name Type Summary
table Table Table to alter.
column TableColumn Column to alter.
constraint ColumnConstraint Contraint to be dropped.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- column is null.

-or- constraint is null.

ValidationException Thrown when the configuration is not valid.

DropForeignKey

Drops a foreign key.

Signature:
public Void DropForeignKey(table, foreignKey)
Parameters
Name Type Summary
table Table Table to alter.
foreignKey ForeignKey Foreign key to drop.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- foreignKey is null.

ValidationException Thrown when the configuration is not valid.

DropIndex

Drops an index.

Signature:
public Void DropIndex(table, index)
Parameters
Name Type Summary
table Table Table to alter.
index Index Index to drop.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- index is null.

ValidationException Thrown when the configuration is not valid.

DropPrimaryKey

Drops a primary key index.

Signature:
public Void DropPrimaryKey(table, primaryKey)
Parameters
Name Type Summary
table Table Table to alter.
primaryKey Index Index to drop.
Exceptions
Type Summary
ArgumentNullException

Thrown when table is null.

-or- primaryKey is null.

ValidationException Thrown when the configuration is not valid.

DropTable

Drops a table.

Signature:
public Void DropTable(table)
Parameters
Name Type Summary
table Table Table to drop.
Exceptions
Type Summary
ArgumentNullException Thrown when table is null.
ValidationException Thrown when the configuration is not valid.

DropView

Drops a view.

Signature:
public Void DropView(view)
Parameters
Name Type Summary
view View View to drop.
Exceptions
Type Summary
ArgumentNullException Thrown when view is null.
ValidationException Thrown when the configuration is not valid.

GrantPermissions

Grants permission to a grantee to access a database object.

Signature:
public Void GrantPermissions(grant)
Remarks

This method does nothing for Sql Server.

Parameters
Name Type Summary
grant Grant Grant configuration.

RenameTable

Renames a table.

Signature:
public Void RenameTable(tableName, newTableName)
Parameters
Name Type Summary
tableName TableName Name of the table to be renamed.
newTableName String New table name.
Exceptions
Type Summary
ArgumentNullException Thrown when tableName is null.
ArgumentNullOrEmptyException Thrown when newTableName is null or empty.
ValidationException Thrown when the configuration is not valid.