找不到合适的重载NHibernate Execute函数

时间:2010-12-02 12:22:02

标签: c# nhibernate

我找不到NHibernate SchemaExport.Execute

的重载功能

http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx

这四个布尔人做了什么?

new SchemaExport(Configuration).Execute(true, true, false, true, session.Connection, Console.Out);

1 个答案:

答案 0 :(得分:2)

在NH2.1中,SchemaExport.Execute()的第4个bool参数被删除。它表明你希望DDL格式化得很好。如果您要求NH2.1 +将DDL编写到控制台,则默认情况下它会很好地格式化。无需单独选项。这是NH2.0的签名......

    /// <summary>
    /// Executes the Export of the Schema in the given connection
    /// </summary>
    /// <param name="script"><see langword="true" /> if the ddl should be outputted in the Console.</param>
    /// <param name="export"><see langword="true" /> if the ddl should be executed against the Database.</param>
    /// <param name="justDrop"><see langword="true" /> if only the ddl to drop the Database objects should be executed.</param>
    /// <param name="format"><see langword="true" /> if the ddl should be nicely formatted instead of one statement per line.</param>
    /// <param name="connection">
    /// The connection to use when executing the commands when export is <see langword="true" />.
    /// Must be an opened connection. The method doesn't close the connection.
    /// </param>
    /// <param name="exportOutput">The writer used to output the generated schema</param>
    /// <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!
    /// </remarks>
    public void Execute(bool script, bool export, bool justDrop, bool format,
                        IDbConnection connection, TextWriter exportOutput)
            -- remainder of method --