Skip to content

Commit f46986e

Browse files
committed
No need to call Initilize from private SchemaExport.Execute method. Renamed it to ExecuteInitialized
1 parent b3a72d4 commit f46986e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/NHibernate/Async/Tool/hbm2ddl/SchemaExport.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ public partial class SchemaExport
145145
return ExecuteAsync(null, execute, true, exportOutput, cancellationToken);
146146
}
147147

148-
private async Task ExecuteAsync(Action<string> scriptAction, bool execute, bool throwOnError, TextWriter exportOutput,
148+
private async Task ExecuteInitializedAsync(Action<string> scriptAction, bool execute, bool throwOnError, TextWriter exportOutput,
149149
DbCommand statement, string sql, CancellationToken cancellationToken = default(CancellationToken))
150150
{
151151
cancellationToken.ThrowIfCancellationRequested();
152-
await (InitializeAsync(cancellationToken)).ConfigureAwait(false);
153152
try
154153
{
155154
string formatted = formatter.Format(sql);
@@ -268,14 +267,14 @@ public async Task ExecuteAsync(Action<string> scriptAction, bool execute, bool j
268267
{
269268
for (int i = 0; i < dropSQL.Length; i++)
270269
{
271-
await (ExecuteAsync(scriptAction, execute, false, exportOutput, statement, dropSQL[i], cancellationToken)).ConfigureAwait(false);
270+
await (ExecuteInitializedAsync(scriptAction, execute, false, exportOutput, statement, dropSQL[i], cancellationToken)).ConfigureAwait(false);
272271
}
273272

274273
if (!justDrop)
275274
{
276275
for (int j = 0; j < createSQL.Length; j++)
277276
{
278-
await (ExecuteAsync(scriptAction, execute, true, exportOutput, statement, createSQL[j], cancellationToken)).ConfigureAwait(false);
277+
await (ExecuteInitializedAsync(scriptAction, execute, true, exportOutput, statement, createSQL[j], cancellationToken)).ConfigureAwait(false);
279278
}
280279
}
281280
}

src/NHibernate/Tool/hbm2ddl/SchemaExport.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ public void Drop(TextWriter exportOutput, bool execute)
164164
Execute(null, execute, true, exportOutput);
165165
}
166166

167-
private void Execute(Action<string> scriptAction, bool execute, bool throwOnError, TextWriter exportOutput,
167+
private void ExecuteInitialized(Action<string> scriptAction, bool execute, bool throwOnError, TextWriter exportOutput,
168168
DbCommand statement, string sql)
169169
{
170-
Initialize();
171170
try
172171
{
173172
string formatted = formatter.Format(sql);
@@ -272,14 +271,14 @@ public void Execute(Action<string> scriptAction, bool execute, bool justDrop, Db
272271
{
273272
for (int i = 0; i < dropSQL.Length; i++)
274273
{
275-
Execute(scriptAction, execute, false, exportOutput, statement, dropSQL[i]);
274+
ExecuteInitialized(scriptAction, execute, false, exportOutput, statement, dropSQL[i]);
276275
}
277276

278277
if (!justDrop)
279278
{
280279
for (int j = 0; j < createSQL.Length; j++)
281280
{
282-
Execute(scriptAction, execute, true, exportOutput, statement, createSQL[j]);
281+
ExecuteInitialized(scriptAction, execute, true, exportOutput, statement, createSQL[j]);
283282
}
284283
}
285284
}

0 commit comments

Comments
 (0)