Hi,

Thanks, just what I need.
Regards
Sean.

From: [email protected] [mailto:[email protected]] On Behalf Of 
Ricardo Peres
Sent: 20 May 2013 14:23
To: [email protected]
Subject: [nhusers] Re: testing whether a schema is created or is up-to-date

Sure, an example using loquacious configuration:

Configuration cfg = this.CreateConfiguration()
.DataBaseIntegration(db =>
{
            db.ConnectionStringName = "connectionStringName";
            db.Dialect<MsSql2008Dialect>();
            db.Driver<Sql2008ClientDriver>();
            db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'";
            db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
            db.SchemaAction = SchemaAutoAction.Validate;
})

The key is the SchemaAutoAction.Validate, it will check if any table is missing 
or does not have the required columns, in which case an exception will be 
thrown when the session factory is built. The other useful value is Update, 
which will create them.

RP


On Monday, May 20, 2013 7:12:20 AM UTC+1, Sean Farrow wrote:
Hi,

I'm working on a project where I need to test whether a schema is up-to-date or 
has even been created.
I'm currently looking at the number of tables in the database and checking 
whether it is equal to the number of map files in the project.
Is there a more reliable way using NHibernate only?
Help appreciated.
Cheers
Sean.
--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to