@@ -11,6 +11,7 @@ namespace NHibernate.Tool.hbm2ddl
11
11
public class SchemaUpdate
12
12
{
13
13
private static readonly IInternalLogger log = LoggerProvider . LoggerFor ( typeof ( SchemaUpdate ) ) ;
14
+ private bool wasInitialized ;
14
15
private readonly Configuration configuration ;
15
16
private readonly IConnectionHelper connectionHelper ;
16
17
private readonly Dialect . Dialect dialect ;
@@ -42,6 +43,24 @@ public SchemaUpdate(Configuration cfg, Settings settings)
42
43
formatter = ( settings . SqlStatementLogger . FormatSql ? FormatStyle . Ddl : FormatStyle . None ) . Formatter ;
43
44
}
44
45
46
+ private void Initialize ( )
47
+ {
48
+ if ( wasInitialized )
49
+ {
50
+ return ;
51
+ }
52
+
53
+ string autoKeyWordsImport = PropertiesHelper . GetString ( Environment . Hbm2ddlKeyWords , configuration . Properties , "not-defined" ) ;
54
+ autoKeyWordsImport = autoKeyWordsImport . ToLowerInvariant ( ) ;
55
+ if ( autoKeyWordsImport == Hbm2DDLKeyWords . AutoQuote )
56
+ {
57
+ SchemaMetadataUpdater . Update ( configuration , dialect ) ;
58
+ SchemaMetadataUpdater . QuoteTableAndColumns ( configuration , dialect ) ;
59
+ }
60
+
61
+ wasInitialized = true ;
62
+ }
63
+
45
64
/// <summary>
46
65
/// Returns a List of all Exceptions which occurred during the export.
47
66
/// </summary>
@@ -137,13 +156,7 @@ public void Execute(Action<string> scriptAction, bool doUpdate)
137
156
{
138
157
log . Info ( "Running hbm2ddl schema update" ) ;
139
158
140
- string autoKeyWordsImport = PropertiesHelper . GetString ( Environment . Hbm2ddlKeyWords , configuration . Properties , "not-defined" ) ;
141
- autoKeyWordsImport = autoKeyWordsImport . ToLowerInvariant ( ) ;
142
- if ( autoKeyWordsImport == Hbm2DDLKeyWords . AutoQuote )
143
- {
144
- SchemaMetadataUpdater . Update ( configuration , dialect ) ;
145
- SchemaMetadataUpdater . QuoteTableAndColumns ( configuration , dialect ) ;
146
- }
159
+ Initialize ( ) ;
147
160
148
161
DbConnection connection ;
149
162
DbCommand stmt = null ;
0 commit comments