Table of Contents

Method ReadDatabase

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

ReadDatabase(string, ConfigType)

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

public Database ReadDatabase(string contents, ConfigType configType)

Parameters

contents string

A string containing a Velocity database definition in the specified format.

configType ConfigType

The format of the configuration (XML, JSON, or YAML).

Returns

Database

A populated Database object containing one or more schemas.

Examples

string databaseJson = @"{
    'schemas': [
        {
            'name': 'app_schema',
            'tables': [...]
        }
    ]
}";

using (var m = new Manager())
{
    var database = m.ReadDatabase(databaseJson, ConfigType.Json);
}

Remarks

WARNING: Multi-schema database operations are not available in the Community Edition of Velocity. They require the Full Edition.

Exceptions

CustomViewCodeCompilationException

Thrown when a custom code-based view does not compile properly.

ColumnNotFoundException

Thrown if any referenced columns do not exist in tables.

ReadDatabase(Stream, ConfigType)

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

public Database ReadDatabase(Stream stream, ConfigType configType)

Parameters

stream Stream

A readable stream containing the database definition.

configType ConfigType

The format of the configuration (XML, JSON, or YAML).

Returns

Database

A populated Database object containing one or more schemas.

Examples

using (var fileStream = File.OpenRead("database.xml"))
using (var m = new Manager())
{
    var database = m.ReadDatabase(fileStream, ConfigType.Xml);
    Console.WriteLine($"Loaded {database.Schemas.Count} schema(s)");
}

Remarks

WARNING: Multi-schema database operations are not available in the Community Edition of Velocity. They require the Full Edition.

Exceptions

CustomViewCodeCompilationException

Thrown when a custom code-based view does not compile properly.

ColumnNotFoundException

Thrown if any referenced columns do not exist in tables.