Method ExportDatabase
- Namespace
- YndigoBlue.Velocity.Engine
- Assembly
- YndigoBlue.Velocity.dll
ExportDatabase(Database, ConfigType, string, ExportConfig, bool)
Exports an entire database (multiple schemas) including all schema definitions and table data to files.
public void ExportDatabase(Database database, ConfigType configType, string dataPath, ExportConfig exportConfig = null, bool includeViews = false)
Parameters
databaseDatabaseThe Database containing schemas to export.
configTypeConfigTypeThe format for schema definition files (XML, JSON, or YAML).
dataPathstringThe directory path where schema definitions and CSV data files will be created.
exportConfigExportConfigOptional ExportConfig for CSV export settings. Uses defaults if null.
includeViewsboolIf true, includes view definitions in the schema exports.
Examples
using (var m = new Manager(conn))
{
var database = m.LoadDatabase();
// Export all schemas and data
m.ExportDatabase(database, ConfigType.Xml, "./full_backup", includeViews: true);
Console.WriteLine($"Exported {database.Schemas.Count} schemas");
}
Exceptions
- DbException
Thrown when a database error occurs.