@@ -28,6 +28,8 @@ private class TestDataInvalidException : Exception
28
28
29
29
private bool isSchemaRecreated = false ;
30
30
31
+ protected override void CheckRequirements ( ) => Require . ProviderIsNot ( StorageProvider . Oracle ) ;
32
+
31
33
protected override DomainConfiguration BuildConfiguration ( )
32
34
{
33
35
var configuration = base . BuildConfiguration ( ) ;
@@ -39,20 +41,23 @@ protected override Domain BuildDomain(DomainConfiguration configuration)
39
41
{
40
42
var firstTryConfig = configuration . Clone ( ) ;
41
43
firstTryConfig . UpgradeMode = DomainUpgradeMode . Validate ;
44
+ Domain domain = null ;
42
45
try {
43
46
//try to avoid long population
44
- var domain = base . BuildDomain ( firstTryConfig ) ;
47
+ domain = base . BuildDomain ( firstTryConfig ) ;
45
48
ValidateTestData ( domain ) ;
46
49
return domain ;
47
50
}
48
51
catch ( SchemaSynchronizationException exception ) {
49
52
//schemas differ
50
53
isSchemaRecreated = true ;
54
+ domain . DisposeSafely ( ) ;
51
55
}
52
56
catch ( TestDataInvalidException ) {
53
57
// schemas are the same but data in not ok
54
58
// create so override existing schema and publish correct data
55
59
isSchemaRecreated = true ;
60
+ domain . DisposeSafely ( ) ;
56
61
}
57
62
var secondTryConfig = configuration . Clone ( ) ;
58
63
secondTryConfig . UpgradeMode = DomainUpgradeMode . Recreate ;
@@ -352,10 +357,11 @@ private static void PopulateContactsForEmployees(Domain domain)
352
357
{
353
358
using ( var session = domain . OpenSession ( ) )
354
359
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 ) ) {
356
361
_ = new Contact ( session , employee , ContactType . Email , ContactGenerator . GetEmail ( ) ) { Active = true } ;
357
362
_ = new Contact ( session , employee , ContactType . Fax , ContactGenerator . GetPhone ( ) ) { Active = true } ;
358
363
_ = new Contact ( session , employee , ContactType . Phone , ContactGenerator . GetPhone ( ) ) { Active = true } ;
364
+ session . SaveChanges ( ) ;
359
365
}
360
366
tx . Complete ( ) ;
361
367
}
@@ -366,7 +372,7 @@ public static void PopulateRecipients(Domain domain)
366
372
var random = new Random ( ) ;
367
373
using ( var session = domain . OpenSession ( ) )
368
374
using ( var tx = session . OpenTransaction ( ) ) {
369
- var customers = session . Query . All < Customer > ( ) . ToArray ( ) ;
375
+ var customers = session . Query . All < Customer > ( ) . ToArray ( CustomerCount ) ;
370
376
foreach ( var customer in customers ) {
371
377
var contactsToChoose = customer . Contacts . ToArray ( ) ;
372
378
_ = new Recipient ( session , new Audience ( session ) ) {
0 commit comments