NHibernate new SchemaExport (cfg) .Execute (false, true, false, false); There is no fourth parameter bool

I am trying to follow the NHibernate training course, "Your First NHibernate Application: Revision 4" at NHibernate Forge.

But the line: new SchemaExport(cfg).Execute(false, true, false, false);

It does not compile, because it says that there is no overload that takes four Boolean parameters!

I am using NHibernate 2.1.2 in Visual Studio 2008 C #. All the samples that I saw clearly use this call with four logical parameters. Has something changed in the latest version of NHibernate with the challenge SchemaExport()?

I am trying to create a simple table in my database in a testing method. I am using MS SQL Express 2008 as my database. I tried the call Create(true, true), and it at least compiles and runs, but the table is never stored in the database.

+4
source share
2 answers

Yes, it has changed from NH2.0.xGA to NH2.1.0 :

In SchemaExport.Execute, the "format" parameter has been deleted; (NH-1701) format_sql configuration property enabled (default true)

It was:

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

Now this:

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

so just remove the parameter format. This has been replaced by the property format_sql:

<property name="format_sql">true</property> 

Here is the relevant question .

+6
source

Add this item:

using NHibernate.Tool.hbm2ddl;
-1

Source: https://habr.com/ru/post/1752678/


All Articles