C# Class Utilities.ORM.Manager.Schema.Default.Database.SQLServer.SQLServerSchemaGenerator

SQL Server schema generator
Inheritance: ISchemaGenerator
显示文件 Open project: JaCraig/Craig-s-Utility-Library

Public Methods

Method Description
GenerateSchema ( ISource DesiredStructure, ISourceInfo Source ) : IEnumerable

Generates a list of commands used to modify the source. If it does not exist prior, the commands will create the source from scratch. Otherwise the commands will only add new fields, tables, etc. It does not delete old fields.

GetSourceStructure ( ISourceInfo Source ) : ISource

Gets the structure of a source

SQLServerSchemaGenerator ( QueryProvider Provider, SourceProvider SourceProvider ) : System

Constructor

Setup ( IMapping>.ListMapping Mappings, IDatabase Database, QueryProvider QueryProvider, Graph Structure ) : void

Sets up the specified database schema

SourceExists ( string Source, ISourceInfo Info ) : bool

Checks if a source exists

StoredProcedureExists ( string StoredProcedure, ISourceInfo Source ) : bool

Checks if a stored procedure exists

TableExists ( string Table, ISourceInfo Source ) : bool

Checks if a table exists

TriggerExists ( string Trigger, ISourceInfo Source ) : bool

Checks if a trigger exists

ViewExists ( string View, ISourceInfo Source ) : bool

Checks if a view exists

Private Methods

Method Description
BuildCommands ( ISource DesiredStructure, ISource CurrentStructure ) : IEnumerable
Exists ( string Command, string Value, ISourceInfo Source ) : bool
GetAlterFunctionCommand ( Function Function, Function CurrentFunction ) : IEnumerable
GetAlterStoredProcedure ( StoredProcedure StoredProcedure, StoredProcedure CurrentStoredProcedure ) : IEnumerable
GetAlterTableCommand ( Utilities.DataTypes.Table Table, ITable CurrentTable ) : IEnumerable
GetAlterTriggerCommand ( Utilities.DataTypes.Table Table, ITable CurrentTable ) : IEnumerable
GetAlterViewCommand ( View View, View CurrentView ) : IEnumerable
GetForeignKeyCommand ( Utilities.DataTypes.Table Table ) : IEnumerable
GetForeignKeyCommand ( Utilities.DataTypes.Table Table, ITable CurrentTable ) : IEnumerable
GetFunctionCommand ( Function Function ) : IEnumerable
GetStoredProcedure ( StoredProcedure StoredProcedure ) : IEnumerable
GetTableCommand ( Utilities.DataTypes.Table Table ) : IEnumerable
GetTriggerCommand ( Utilities.DataTypes.Table Table ) : IEnumerable
GetViewCommand ( View View ) : IEnumerable
SetupAuditTables ( ITable Table ) : ITable
SetupAuditTables ( IDatabase Key, Schema TempDatabase ) : void
SetupDeleteTrigger ( ITable Table ) : void
SetupInsertUpdateTrigger ( ITable Table ) : void
SetupJoiningTables ( IMapping>.ListMapping Mappings, IDatabase Key, Schema TempDatabase ) : void
SetupJoiningTablesEnumerable ( IMapping>.ListMapping Mappings, IMapping Mapping, IProperty Property, IDatabase Key, Schema TempDatabase ) : void
SetupProperties ( ITable Table, IMapping Mapping ) : void
SetupTables ( IMapping>.ListMapping Mappings, IDatabase Key, Database TempDatabase, Graph Structure ) : void

Method Details

GenerateSchema() public method

Generates a list of commands used to modify the source. If it does not exist prior, the commands will create the source from scratch. Otherwise the commands will only add new fields, tables, etc. It does not delete old fields.
public GenerateSchema ( ISource DesiredStructure, ISourceInfo Source ) : IEnumerable
DesiredStructure ISource Desired source structure
Source ISourceInfo Source to use
return IEnumerable

GetSourceStructure() public method

Gets the structure of a source
public GetSourceStructure ( ISourceInfo Source ) : ISource
Source ISourceInfo Source to use
return ISource

SQLServerSchemaGenerator() public method

Constructor
public SQLServerSchemaGenerator ( QueryProvider Provider, SourceProvider SourceProvider ) : System
Provider QueryProvider The provider.
SourceProvider SourceProvider The source provider.
return System

Setup() public method

Sets up the specified database schema
public Setup ( IMapping>.ListMapping Mappings, IDatabase Database, QueryProvider QueryProvider, Graph Structure ) : void
Mappings IMapping>.ListMapping The mappings.
Database IDatabase The database.
QueryProvider QueryProvider The query provider.
Structure Graph The structure.
return void

SourceExists() public method

Checks if a source exists
public SourceExists ( string Source, ISourceInfo Info ) : bool
Source string Source to check
Info ISourceInfo Source info to use
return bool

StoredProcedureExists() public method

Checks if a stored procedure exists
public StoredProcedureExists ( string StoredProcedure, ISourceInfo Source ) : bool
StoredProcedure string Stored procedure to check
Source ISourceInfo Source to use
return bool

TableExists() public method

Checks if a table exists
public TableExists ( string Table, ISourceInfo Source ) : bool
Table string Table to check
Source ISourceInfo Source to use
return bool

TriggerExists() public method

Checks if a trigger exists
public TriggerExists ( string Trigger, ISourceInfo Source ) : bool
Trigger string Trigger to check
Source ISourceInfo Source to use
return bool

ViewExists() public method

Checks if a view exists
public ViewExists ( string View, ISourceInfo Source ) : bool
View string View to check
Source ISourceInfo Source to use
return bool