@@ -28,6 +28,8 @@ private class TestDataInvalidException : Exception
2828
2929 private bool isSchemaRecreated = false ;
3030
31+ protected override void CheckRequirements ( ) => Require . ProviderIsNot ( StorageProvider . Oracle ) ;
32+
3133 protected override DomainConfiguration BuildConfiguration ( )
3234 {
3335 var configuration = base . BuildConfiguration ( ) ;
@@ -39,20 +41,23 @@ protected override Domain BuildDomain(DomainConfiguration configuration)
3941 {
4042 var firstTryConfig = configuration . Clone ( ) ;
4143 firstTryConfig . UpgradeMode = DomainUpgradeMode . Validate ;
44+ Domain domain = null ;
4245 try {
4346 //try to avoid long population
44- var domain = base . BuildDomain ( firstTryConfig ) ;
47+ domain = base . BuildDomain ( firstTryConfig ) ;
4548 ValidateTestData ( domain ) ;
4649 return domain ;
4750 }
4851 catch ( SchemaSynchronizationException exception ) {
4952 //schemas differ
5053 isSchemaRecreated = true ;
54+ domain . DisposeSafely ( ) ;
5155 }
5256 catch ( TestDataInvalidException ) {
5357 // schemas are the same but data in not ok
5458 // create so override existing schema and publish correct data
5559 isSchemaRecreated = true ;
60+ domain . DisposeSafely ( ) ;
5661 }
5762 var secondTryConfig = configuration . Clone ( ) ;
5863 secondTryConfig . UpgradeMode = DomainUpgradeMode . Recreate ;
@@ -352,10 +357,11 @@ private static void PopulateContactsForEmployees(Domain domain)
352357 {
353358 using ( var session = domain . OpenSession ( ) )
354359 using ( var tx = session . OpenTransaction ( ) ) {
355- foreach ( var employee in session . Query . All < Employee > ( ) ) {
360+ foreach ( var employee in session . Query . All < Employee > ( ) . ToArray ( 45 ) ) {
356361 _ = new Contact ( session , employee , ContactType . Email , ContactGenerator . GetEmail ( ) ) { Active = true } ;
357362 _ = new Contact ( session , employee , ContactType . Fax , ContactGenerator . GetPhone ( ) ) { Active = true } ;
358363 _ = new Contact ( session , employee , ContactType . Phone , ContactGenerator . GetPhone ( ) ) { Active = true } ;
364+ session . SaveChanges ( ) ;
359365 }
360366 tx . Complete ( ) ;
361367 }
@@ -366,7 +372,7 @@ public static void PopulateRecipients(Domain domain)
366372 var random = new Random ( ) ;
367373 using ( var session = domain . OpenSession ( ) )
368374 using ( var tx = session . OpenTransaction ( ) ) {
369- var customers = session . Query . All < Customer > ( ) . ToArray ( ) ;
375+ var customers = session . Query . All < Customer > ( ) . ToArray ( CustomerCount ) ;
370376 foreach ( var customer in customers ) {
371377 var contactsToChoose = customer . Contacts . ToArray ( ) ;
372378 _ = new Recipient ( session , new Audience ( session ) ) {
0 commit comments