Table of Contents

Class Manager

Namespace
YndigoBlue.Velocity.Engine
Assembly
YndigoBlue.Velocity.dll

The main class used to perform operations within Velocity.

public class Manager : IDisposable
Inheritance
Manager
Implements

Remarks

For all connected operations a Manager object must be tied to a specific DatasourceType. Optionally it can be created through the default constructor to enable disconnected file operations such as reading and writing schema files.

Managers wrapped in using clauses are the main way to interact with Velocity and the class provides a large number of methods that are the key to the Framework. Most uses of Velocity will involve a number of methods being called one after the other, interacting with a specific database connection. Managers allow for a wide variety of operations including DDL (Data Definition Laguage), DML (Data Manipulation Language) and DQL (Data Query Language).

Note

Use of the Manager class is essentially to your use of Velocity, to achieve success with this framework you need to be familiar with its operation.

You should always wrap a Manager in a using clause so that the unmanaged database connection object can be disposed correctly.

Constructors

Manager()

Creates a disconnected Manager which can be used for file operations if required, such as loading and writing schema files.

Manager(DatasourceType, string, string)

Creates a connected Manager from a DatasourceType, a connection string and an optional context settings string.

Manager(IDatasourceConnection)

Creates a connected Manager from an IDatasourceConnection.

Fields

LogConfigFile

Path to log4net config.

Properties

ConnectionString

Gets the connection string used to connect to the datasource.

DatasourceConnection

Gets the datasource connection object that was used to create this manager.

DatasourceType

Gets the type of datasource (database system) that this manager is connected to.

Methods

AddRecord(Record)

Inserts a single record into a table and returns the auto-generated identity value.

AddRecordNoIdentity(Record)

Inserts a single record into a table without returning an identity value (for tables without auto-increment keys).

AddRecords(Table, IEnumerable<Column>, Query)

Inserts multiple records into a table using the results from a query (INSERT INTO ... SELECT pattern).

BeginTransaction()
BeginTransaction(IsolationLevel)

Begins a database transaction with a specific isolation level.

BuildDatabase(Database, bool, bool)

Creates or recreates a complete database with multiple schemas, including all tables, views, constraints, and indexes.

BuildSchema(Schema, bool, bool)

Creates or recreates a complete schema in the database including all tables, views, constraints, and indexes.

BuildTable(Table, bool, bool)

Creates or recreates a table in the database including all columns, constraints, and indexes.

CheckExists(string)

Checks whether a schema exists in the database.

CommitTransaction()

Commits the current database transaction, making all changes permanent.

CreateColumn(Column)

Adds a new column to an existing table in the database.

CreateConstraint(Constraint)

Creates a constraint (primary key, foreign key, unique, check, or default) on an existing table.

CreateFullTextIndex(FullTextIndex, bool)

Creates a full-text index for advanced text search capabilities on text columns.

CreateIndex(Index, bool)

Creates a standard index on one or more columns of an existing table.

CreateSchema(Schema, bool)

Creates an empty schema in the database (schema namespace only, no tables).

CreateSpatialIndex(SpatialIndex, bool)

Creates a spatial index for geospatial queries on geometry or geography columns.

CreateTable(Table)

Creates a table in the database with all its columns, constraints, and indexes.

CreateTable(Table, bool)

Creates a table in the database with all its columns, constraints, and indexes, optionally overwriting if it exists.

CreateView(View)
CreateView(View, bool)

Creates a database view based on a query, optionally overwriting if it exists.

DeleteRecords(Delete)

Deletes one or more records from a table based on specified criteria.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

DropIndex(Index)

Drops (deletes) an index from the database.

DropSchema(Schema)

Drops (deletes) a schema and all its objects from the database.

DropTable(Table)

Drops (deletes) a table from the database, removing the table structure and all its data.

DropView(View)

Drops (deletes) a view from the database.

EmptyDatabase(Database, bool)

Removes all tables, views, constraints, and indexes from all schemas in the database, leaving empty schemas.

EmptySchema(Schema, bool)

Removes all tables, views, constraints, and indexes from a schema, leaving an empty schema.

EmptyTable(Table)

Deletes all records from a table while keeping the table structure intact.

ExportData(Query, string, ExportConfig)

Exports query results to a CSV file.

ExportData(Table, string, ExportConfig)

Exports all data from a table to a CSV file.

ExportData(View, string, ExportConfig)

Exports all data from a view to a CSV file.

ExportDatabase(Database, ConfigType, string, ExportConfig, bool)

Exports an entire database (multiple schemas) including all schema definitions and table data to files.

ExportSchema(Schema, ConfigType, string, ExportConfig, bool)

Exports an entire schema including its definition and all table data to files.

FullTextRetrieval(Table, IEnumerable<Column>, string)

Performs a full-text search on a table and returns all results in a disconnected result set.

FullTextSearch(Table, IEnumerable<Column>, string)

Performs a full-text search on a table and returns a forward-only, connected data reader.

GetDatabseInfo()

Retrieves metadata information about the connected database system.

GetScalar(Query)

Executes a query and returns a single scalar value (typically from aggregate functions or single-value queries).

GetScalar<T>(Query)

Executes a query and returns a single scalar value cast to a specific type.

GetSqlBuildDatabase(Database, bool, bool)

Generates the SQL script that would be used to build a database without executing it.

GetSqlBuildSchema(Schema, bool, bool)

Generates the SQL script that would be used to build a schema without executing it.

ImportData(Table, string, ImportConfig)

Imports data from a CSV file into a database table.

LoadDatabase()

Loads all schemas from the connected database into a Database object.

LoadDatabase(IEnumerable<string>)

Loads specific schemas from the connected database into a Database object.

LoadSchema(string)

Loads a specific schema from the connected database into a Schema object.

ReadDatabase(Stream, ConfigType)

Reads a database definition from a stream and returns an in-memory Database object containing multiple schemas.

ReadDatabase(string, ConfigType)

Reads a database definition from a string and returns an in-memory Database object containing multiple schemas.

ReadDatabaseFromFile(string, ConfigType)

Reads a database definition from a file and returns an in-memory Database object containing multiple schemas.

ReadSchema(Stream, ConfigType)

Reads a schema definition from a stream and returns an in-memory Schema object.

ReadSchema(string, ConfigType)

Reads a schema definition from a string and returns an in-memory Schema object.

ReadSchemaFromFile(string, ConfigType)

Reads a schema definition from a file and returns an in-memory Schema object.

Retrieve(Query)
RollbackTransaction()

Rolls back the current database transaction, undoing all changes made since BeginTransaction.

RunSql(string)

Executes a raw SQL command against the database.

Search(Query)
UpdateColumn(Column)

Updates an existing column's properties in the database.

UpdateRecords(Update)

Updates one or more records in a table based on specified criteria.

UpdateSchema(Schema, bool)

Updates an existing schema to match the provided schema definition by adding, modifying, or removing objects.

ValidateSchema(Schema)

Validates that a schema definition matches the actual schema structure in the database.

WriteDatabase(Database, Stream, ConfigType, bool)

Writes a database definition (with multiple schemas) to a stream in the specified format.

WriteDatabase(Database, string, ConfigType, bool)

Writes a database definition (with multiple schemas) to a file in the specified format.

WriteSchema(Schema, Stream, ConfigType, bool)

Writes a schema definition to a stream in the specified format (XML, JSON, or YAML).

WriteSchema(Schema, string, ConfigType, bool)

Writes a schema definition to a file in the specified format (XML, JSON, or YAML).

Events

CommandCompletedLogUpdate

Event raised when a command completes execution, providing a log message.

CommandInfoDetails

Event raised when a command completes, providing timing and performance information.

CommandStartingLogUpdate

Event raised when a command starts execution, providing a log message.