Table of Contents

Method ReadDatabaseFromFile

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

ReadDatabaseFromFile(string, ConfigType)

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

public Database ReadDatabaseFromFile(string filePath, ConfigType configType)

Parameters

filePath string

Path to a file containing a Velocity database definition.

configType ConfigType

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

Returns

Database

A populated Database object containing one or more schemas.

Examples

using (var m = new Manager())
{
    // Read a database definition with multiple schemas
    var database = m.ReadDatabaseFromFile("database.json", ConfigType.Json);

    Console.WriteLine($"Database contains {database.Schemas.Count} schema(s)");
    foreach (var schema in database.Schemas)
    {
        Console.WriteLine($"  Schema: {schema.Name}");
    }
}

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.