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
contentsstringA string containing a Velocity database definition in the specified format.
configTypeConfigTypeThe format of the configuration (XML, JSON, or YAML).
Returns
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
streamStreamA readable stream containing the database definition.
configTypeConfigTypeThe format of the configuration (XML, JSON, or YAML).
Returns
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.