@@ -292,6 +292,17 @@ protected virtual void AddMappings(Configuration configuration)
292
292
293
293
protected virtual void CreateSchema ( )
294
294
{
295
+ if ( Sfi ? . ConnectionProvider . Driver is FirebirdClientDriver fbDriver )
296
+ {
297
+ // Firebird will pool each connection created during the test and will marked as used any table
298
+ // referenced by queries. It will at best delays those tables drop until connections are actually
299
+ // closed, or immediately fail dropping them.
300
+ // This results in other tests failing when they try to create tables with same name.
301
+ // By clearing the connection pool the tables will get dropped. This is done by the following code.
302
+ // Moved from NH1908 test case, contributed by Amro El-Fakharany.
303
+ fbDriver . ClearPool ( null ) ;
304
+ }
305
+
295
306
using ( var optionalConnection = OpenConnectionForSchemaExport ( ) )
296
307
SchemaExport . Create ( OutputDdl , true , optionalConnection ) ;
297
308
}
@@ -303,17 +314,6 @@ protected virtual void DropSchema()
303
314
304
315
public static void DropSchema ( bool useStdOut , SchemaExport export , ISessionFactoryImplementor sfi , Func < DbConnection > getConnection = null )
305
316
{
306
- if ( sfi ? . ConnectionProvider . Driver is FirebirdClientDriver fbDriver )
307
- {
308
- // Firebird will pool each connection created during the test and will marked as used any table
309
- // referenced by queries. It will at best delays those tables drop until connections are actually
310
- // closed, or immediately fail dropping them.
311
- // This results in other tests failing when they try to create tables with same name.
312
- // By clearing the connection pool the tables will get dropped. This is done by the following code.
313
- // Moved from NH1908 test case, contributed by Amro El-Fakharany.
314
- fbDriver . ClearPool ( null ) ;
315
- }
316
-
317
317
using ( var optionalConnection = getConnection ? . Invoke ( ) )
318
318
export . Drop ( useStdOut , true , optionalConnection ) ;
319
319
}
0 commit comments