Table of Contents

Method WriteSchema

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

WriteSchema(Schema, string, ConfigType, bool)

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

public void WriteSchema(Schema schema, string path, ConfigType configType, bool ignoreUpdateAttributes = true)

Parameters

schema Schema

The Schema object to write to the file.

path string

The file path where the schema will be written.

configType ConfigType

The format to use (XML, JSON, or YAML).

ignoreUpdateAttributes bool

If true, excludes transient schema update metadata from the output.

Examples

using (var m = new Manager(conn))
{
    // Load schema from database
    var schema = m.LoadSchema("app");

    // Write to XML file
    m.WriteSchema(schema, "app_schema.xml", ConfigType.Xml);

    // Write to JSON file
    m.WriteSchema(schema, "app_schema.json", ConfigType.Json);

    // Write to YAML file
    m.WriteSchema(schema, "app_schema.yaml", ConfigType.Yaml);
}

Exceptions

DbException

Thrown when a database error occurs.

WriteSchema(Schema, Stream, ConfigType, bool)

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

public void WriteSchema(Schema schema, Stream stream, ConfigType configType, bool ignoreUpdateAttributes = true)

Parameters

schema Schema

The Schema object to write to the stream.

stream Stream

The writable stream where the schema will be written.

configType ConfigType

The format to use (XML, JSON, or YAML).

ignoreUpdateAttributes bool

If true, excludes transient schema update metadata from the output.

Examples

using (var m = new Manager(conn))
using (var stream = new MemoryStream())
{
    var schema = m.LoadSchema("app");

    // Write to stream
    m.WriteSchema(schema, stream, ConfigType.Json);

    // Read back the JSON
    stream.Position = 0;
    using (var reader = new StreamReader(stream))
    {
        string json = reader.ReadToEnd();
        Console.WriteLine(json);
    }
}

Exceptions

DbException

Thrown when a database error occurs.