NHibernate : NHibernate.Tool.hbm2ddl Namespace

SchemaExport Class

Generates ddl to export table schema for a configured Configuration to the database

public class SchemaExport

Remarks

This Class can be used directly or the command line wrapper NHibernate.Tool.hbm2ddl.exe can be used when a dll can not be directly used.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

Members

See Also: Inherited members from object.

Public Constructors

Create a schema exported for a given Configuration
Create a schema exporter for the given Configuration, with the given database connection properties

Public Methods

Create (bool, bool)
Run the schema creation script
Drop (bool, bool)
Run the drop schema script
Execute (bool, bool, bool, bool)
Executes the Export of the Schema.
Execute (bool, bool, bool, bool, System.Data.IDbConnection, System.IO.TextWriter)
Executes the Export of the Schema in the given connection
SetDelimiter (string) : SchemaExport
Set the end of statement delimiter
SetOutputFile (string) : SchemaExport
Set the output filename. The generated script will be written to this file

Member Details

SchemaExport Constructor

Create a schema exported for a given Configuration

public SchemaExport (NHibernate.Cfg.Configuration cfg)

Parameters

cfg
The NHibernate Configuration to generate the schema from.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

SchemaExport Constructor

Create a schema exporter for the given Configuration, with the given database connection properties

public SchemaExport (NHibernate.Cfg.Configuration cfg, IDictionary connectionProperties)

Parameters

cfg
The NHibernate Configuration to generate the schema from.
connectionProperties
The Properties to use when connecting to the Database.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

Create Method

Run the schema creation script

public void Create (bool script, bool export)

Parameters

script
true if the ddl should be outputted in the Console.
export
true if the ddl should be executed against the Database.

Remarks

This is a convenience method that calls SchemaExport.Execute(bool, bool, bool, bool) and sets the justDrop parameter to false and the format parameter to true.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

Drop Method

Run the drop schema script

public void Drop (bool script, bool export)

Parameters

script
true if the ddl should be outputted in the Console.
export
true if the ddl should be executed against the Database.

Remarks

This is a convenience method that calls SchemaExport.Execute(bool, bool, bool, bool) and sets the justDrop and format parameter to true.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

Execute Method

Executes the Export of the Schema.

public void Execute (bool script, bool export, bool justDrop, bool format)

Parameters

script
true if the ddl should be outputted in the Console.
export
true if the ddl should be executed against the Database.
justDrop
true if only the ddl to drop the Database objects should be executed.
format
true if the ddl should be nicely formatted instead of one statement per line.

Remarks

This method allows for both the drop and create ddl script to be executed.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

Execute Method

Executes the Export of the Schema in the given connection

public void Execute (bool script, bool export, bool justDrop, bool format, System.Data.IDbConnection connection, System.IO.TextWriter exportOutput)

Parameters

script
true if the ddl should be outputted in the Console.
export
true if the ddl should be executed against the Database.
justDrop
true if only the ddl to drop the Database objects should be executed.
format
true if the ddl should be nicely formatted instead of one statement per line.
connection
The connection to use when executing the commands when export is true. Must be an opened connection. The method doesn't close the connection.
exportOutput
The writer used to output the generated schema

Remarks

This method allows for both the drop and create ddl script to be executed. This overload is provided mainly to enable use of in memory databases. It does NOT close the given connection!

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

SetDelimiter Method

Set the end of statement delimiter

public SchemaExport SetDelimiter (string delimiter)

Parameters

delimiter
The end of statement delimiter.

Returns

The SchemaExport object.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000

SetOutputFile Method

Set the output filename. The generated script will be written to this file

public SchemaExport SetOutputFile (string filename)

Parameters

filename
The name of the file to output the ddl to.

Returns

The SchemaExport object.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: NHibernate.Tool.hbm2ddl
Assembly: NHibernate (in NHibernate.dll)
Assembly Versions: 1.2.1.4000