@@ -23,7 +23,7 @@ public class DomainUpgradeTest
2323 [ SetUp ]
2424 public void SetUp ( )
2525 {
26- BuildDomain ( "1" , DomainUpgradeMode . Recreate ) ;
26+ BuildDomain ( 1 , DomainUpgradeMode . Recreate ) ;
2727 FillData ( ) ;
2828 }
2929
@@ -36,17 +36,17 @@ public void TearDown()
3636 [ Test ]
3737 public void UpgradeModeTest ( )
3838 {
39- BuildDomain ( "1" , DomainUpgradeMode . Recreate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
39+ BuildDomain ( 1 , DomainUpgradeMode . Recreate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
4040
41- BuildDomain ( "1" , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
41+ BuildDomain ( 1 , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
4242 AssertEx . Throws < SchemaSynchronizationException > ( ( ) =>
43- BuildDomain ( "1" , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ) ;
43+ BuildDomain ( 1 , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ) ;
4444
45- BuildDomain ( "1" , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
45+ BuildDomain ( 1 , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
4646 AssertEx . Throws < SchemaSynchronizationException > ( ( ) =>
47- BuildDomain ( "1" , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ) ;
47+ BuildDomain ( 1 , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ) ;
4848 AssertEx . Throws < SchemaSynchronizationException > ( ( ) =>
49- BuildDomain ( "1" , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ,
49+ BuildDomain ( 1 , DomainUpgradeMode . Validate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ,
5050 typeof ( M1 . BusinessContact ) , typeof ( M1 . Employee ) , typeof ( M1 . Order ) ) ) ;
5151 }
5252
@@ -57,7 +57,7 @@ public void UpgradeGeneratorsTest()
5757 Require . AnyFeatureSupported ( ProviderFeatures . Sequences | ProviderFeatures . ArbitraryIdentityIncrement ) ;
5858
5959 var generatorCacheSize = 3 ;
60- BuildDomain ( "1" , DomainUpgradeMode . Recreate , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
60+ BuildDomain ( 1 , DomainUpgradeMode . Recreate , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
6161 using ( var session = domain . OpenSession ( ) )
6262 using ( var t = session . OpenTransaction ( ) ) {
6363 for ( var i = 0 ; i < generatorCacheSize ; i ++ ) {
@@ -71,7 +71,7 @@ public void UpgradeGeneratorsTest()
7171 t . Complete ( ) ;
7272 }
7373
74- BuildDomain ( "1" , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
74+ BuildDomain ( 1 , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
7575 using ( var session = domain . OpenSession ( ) )
7676 using ( var t = session . OpenTransaction ( ) ) {
7777 for ( var i = 0 ; i < generatorCacheSize ; i ++ ) {
@@ -86,7 +86,7 @@ public void UpgradeGeneratorsTest()
8686 }
8787
8888 generatorCacheSize = 2 ;
89- BuildDomain ( "1" , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
89+ BuildDomain ( 1 , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
9090 using ( var session = domain . OpenSession ( ) )
9191 using ( var t = session . OpenTransaction ( ) ) {
9292 _ = new M1 . Person { Address = new M1 . Address { City = "City" , Country = "Country" } } ;
@@ -104,7 +104,7 @@ public void UpgradeGeneratorsFirebirdTest()
104104 Require . ProviderIs ( StorageProvider . Firebird ) ;
105105
106106 var generatorCacheSize = 3 ;
107- BuildDomain ( "1" , DomainUpgradeMode . Recreate , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
107+ BuildDomain ( 1 , DomainUpgradeMode . Recreate , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
108108 using ( var session = domain . OpenSession ( ) )
109109 using ( var t = session . OpenTransaction ( ) ) {
110110 for ( var i = 0 ; i < generatorCacheSize ; i ++ ) {
@@ -118,7 +118,7 @@ public void UpgradeGeneratorsFirebirdTest()
118118 t . Complete ( ) ;
119119 }
120120
121- BuildDomain ( "1" , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
121+ BuildDomain ( 1 , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
122122 using ( var session = domain . OpenSession ( ) )
123123 using ( var t = session . OpenTransaction ( ) ) {
124124 for ( var i = 0 ; i < generatorCacheSize ; i ++ ) {
@@ -133,7 +133,7 @@ public void UpgradeGeneratorsFirebirdTest()
133133 }
134134
135135 generatorCacheSize = 2 ; // ignored because Firebird sequences has no increment support
136- BuildDomain ( "1" , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
136+ BuildDomain ( 1 , DomainUpgradeMode . Perform , generatorCacheSize , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
137137 using ( var session = domain . OpenSession ( ) )
138138 using ( var t = session . OpenTransaction ( ) ) {
139139 _ = new M1 . Person { Address = new M1 . Address { City = "City" , Country = "Country" } } ;
@@ -151,15 +151,15 @@ public void UpdateTypeIdTest()
151151 int personTypeId ;
152152 int maxTypeId ;
153153
154- BuildDomain ( "1" , DomainUpgradeMode . Recreate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
154+ BuildDomain ( 1 , DomainUpgradeMode . Recreate , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) ) ;
155155 using ( var session = domain . OpenSession ( ) )
156156 using ( var t = session . OpenTransaction ( ) ) {
157157 personTypeId = session . Query . All < Metadata . Type > ( )
158158 . First ( type => type . Name == "Xtensive.Orm.Tests.Upgrade.Model.Version1.Person" ) . Id ;
159159 maxTypeId = session . Query . All < Metadata . Type > ( ) . Max ( type => type . Id ) ;
160160 }
161161
162- BuildDomain ( "1" , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
162+ BuildDomain ( 1 , DomainUpgradeMode . PerformSafely , null , typeof ( M1 . Address ) , typeof ( M1 . Person ) , typeof ( M1 . BusinessContact ) ) ;
163163 using ( var session = domain . OpenSession ( ) )
164164 using ( var t = session . OpenTransaction ( ) ) {
165165 var businessContactTypeId = session . Query . All < Metadata . Type > ( )
@@ -189,7 +189,7 @@ public void UpdateTypeIdWithMutualRenameTest()
189189 . First ( type => type . Name == "Xtensive.Orm.Tests.Upgrade.Model.Version1.BusinessContact" ) . Id ;
190190 }
191191
192- BuildDomain ( "2" , DomainUpgradeMode . Perform ) ;
192+ BuildDomain ( 2 , DomainUpgradeMode . Perform ) ;
193193 using ( var session = domain . OpenSession ( ) )
194194 using ( var t = session . OpenTransaction ( ) ) {
195195 var newBusinessContactTypeId = session . Query . All < Metadata . Type > ( )
@@ -207,7 +207,7 @@ public void UpgradeToVersion2Test()
207207 {
208208 Require . ProviderIsNot ( StorageProvider . Firebird ) ;
209209
210- BuildDomain ( "2" , DomainUpgradeMode . Perform ) ;
210+ BuildDomain ( 2 , DomainUpgradeMode . Perform ) ;
211211 using ( var session = domain . OpenSession ( ) )
212212 using ( session . OpenTransaction ( ) ) {
213213 Assert . AreEqual ( 2 , session . Query . All < M2 . Person > ( ) . Count ( ) ) ;
@@ -286,7 +286,7 @@ public void UpgradeToVersion2Test()
286286 }
287287 }
288288
289- private void BuildDomain ( string version , DomainUpgradeMode upgradeMode )
289+ private void BuildDomain ( int version , DomainUpgradeMode upgradeMode )
290290 {
291291 if ( domain != null ) {
292292 domain . DisposeSafely ( ) ;
@@ -297,12 +297,12 @@ private void BuildDomain(string version, DomainUpgradeMode upgradeMode)
297297 configuration . Types . Register ( Assembly . GetExecutingAssembly ( ) ,
298298 "Xtensive.Orm.Tests.Upgrade.Model.Version" + version ) ;
299299 configuration . Types . Register ( typeof ( Models . Upgrader ) ) ;
300- using ( Models . Upgrader . Enable ( version ) ) {
300+ using ( Models . Upgrader . EnableForVersion ( version ) ) {
301301 domain = Domain . Build ( configuration ) ;
302302 }
303303 }
304304
305- private void BuildDomain ( string version , DomainUpgradeMode upgradeMode , int ? keyCacheSize , params Type [ ] types )
305+ private void BuildDomain ( int version , DomainUpgradeMode upgradeMode , int ? keyCacheSize , params Type [ ] types )
306306 {
307307 if ( domain != null ) {
308308 domain . DisposeSafely ( ) ;
@@ -319,7 +319,7 @@ private void BuildDomain(string version, DomainUpgradeMode upgradeMode, int? key
319319 }
320320
321321 configuration . Types . Register ( typeof ( Models . Upgrader ) ) ;
322- using ( Models . Upgrader . Enable ( version ) ) {
322+ using ( Models . Upgrader . EnableForVersion ( version ) ) {
323323 domain = Domain . Build ( configuration ) ;
324324 }
325325 }
0 commit comments