Table of Contents

Constructor Manager

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

Manager()

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

public Manager()

Remarks

This constructor creates a manager without tying it to a specific datasource connection. The resulting manager will only be usable for a very small subset of operations focused on reading and writing Velocity Schema files.

Warning

Attempting to use a connected operation after using this constructor will throw an exception.

Using a disconnected Manager to read a schema file.

using (var m = new Manager())
{
    var s = m.ReadSchemaFromFile("schema.json", ConfigType.Json);
}

Manager(IDatasourceConnection)

Creates a connected Manager from an IDatasourceConnection.

public Manager(IDatasourceConnection datasourceConnection)

Parameters

datasourceConnection IDatasourceConnection

A Datasource Connection object that defines various connection parameters.

Remarks

This constructor creates a manager using an instance of a class that implements IDatasourceConnection. This is the prefered constructor for using a Manager is possible and allows you to create a connection to a number of supported Database types. The following types are supported and implement the interface:

Datasource Connection TypeDatabase System
DB2DatasourceConnectionIBM DB2 LUW
MySqlDatasourceConnectionMySQL
OracleDatasourceConnectionOracle Database
PostgreSqlDatasourceConnectionPostgreSQL
SqlServerDatasourceConnectionMicrosoft SQL Server
TeradataDatasourceConnectionTeradata Vantage

Using a Manager to connect to a MySQL database and loading a schema.

var mysdc = new MySqlDatasourceConnection { Hostname = "server", Port = 3306, Username = "user", Password = "pwd1234" };

using (var m = new Manager(mysdc))
{
    // Load a pre existing schema into a Schema object
    var s = m.LoadSchema("velocity_test");
}

Manager(DatasourceType, string, string)

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

public Manager(DatasourceType datasourceType, string connectionString, string contextSettings = "")

Parameters

datasourceType DatasourceType

A DatasourceType enum value representing the database type to connect to.

connectionString string

A standard ADO.NET connection string for this datasource.

contextSettings string

Context settings for this Datasource using the connection string format.

Remarks

This constructor creates a Manager object of a specific DatasourceType using a standard connection string and a Context Settings string which is specified in the standard connection string format with key value pairs separated by semi-colons e.g. "Setting1=Value1;Setting2=Value2".

Using a Manager to connect to a SQL Server database and performing a retrieval.

string connectionString = "Data Source=server,1433;Initial Catalog=mydb;User ID=username;Password=pwd1234;Trust Server Certificate=True";
string contextSettings = "ImportTimeout=120;ImportBatchSize=10000";

using (var m = new Manager(DatasourceType.SQLServer, connectionString, contextSettings))
{
	//Load a pre existing schema into a Schema object
	var s = m.LoadSchema("velocity_test");

	// Perform a search on a table
	var q = new Query(s["import"]);

	// Retrieve results
	foreach (var r in m.Retrieve(q))
	{
		Console.WriteLine(r["VarCharColumn"].ToString());
	}
}