2
2
using System . Collections ;
3
3
using NHibernate . Cache ;
4
4
using NHibernate . Engine ;
5
+ using Iesi . Collections ;
5
6
6
7
namespace NHibernate . Mapping
7
8
{
@@ -19,7 +20,7 @@ public class Subclass : PersistentClass
19
20
/// Initializes a new instance of the <see cref="Subclass"/> class.
20
21
/// </summary>
21
22
/// <param name="superclass">The <see cref="PersistentClass"/> that is the superclass.</param>
22
- public Subclass ( PersistentClass superclass )
23
+ public Subclass ( PersistentClass superclass )
23
24
{
24
25
this . superclass = superclass ;
25
26
}
@@ -65,7 +66,7 @@ public override System.Type ClassPersisterClass
65
66
{
66
67
get
67
68
{
68
- if ( classPersisterClass == null )
69
+ if ( classPersisterClass == null )
69
70
{
70
71
return Superclass . ClassPersisterClass ;
71
72
}
@@ -156,9 +157,9 @@ public override bool IsPolymorphic
156
157
get { return true ; }
157
158
set
158
159
{
159
- if ( value != true )
160
+ if ( value != true )
160
161
{
161
- throw new AssertionFailure ( "IsPolymorphic has to be true for subclasses. There is a bug in NHibernate somewhere." ) ;
162
+ throw new AssertionFailure ( "IsPolymorphic has to be true for subclasses. There is a bug in NHibernate somewhere." ) ;
162
163
}
163
164
}
164
165
}
@@ -171,10 +172,10 @@ public override bool IsPolymorphic
171
172
/// This also adds the <see cref="Property"/> to the Superclass' collection
172
173
/// of Subclass Properties.
173
174
/// </remarks>
174
- public override void AddProperty ( Property p )
175
+ public override void AddProperty ( Property p )
175
176
{
176
- base . AddProperty ( p ) ;
177
- Superclass . AddSubclassProperty ( p ) ;
177
+ base . AddProperty ( p ) ;
178
+ Superclass . AddSubclassProperty ( p ) ;
178
179
}
179
180
180
181
/// <summary>
@@ -191,7 +192,7 @@ public override Table Table
191
192
set
192
193
{
193
194
base . Table = value ;
194
- Superclass . AddSubclassTable ( value ) ;
195
+ Superclass . AddSubclassTable ( value ) ;
195
196
}
196
197
}
197
198
@@ -211,8 +212,8 @@ public override ICollection PropertyClosureCollection
211
212
get
212
213
{
213
214
ArrayList retVal = new ArrayList ( ) ;
214
- retVal . AddRange ( PropertyCollection ) ;
215
- retVal . AddRange ( Superclass . PropertyClosureCollection ) ;
215
+ retVal . AddRange ( PropertyCollection ) ;
216
+ retVal . AddRange ( Superclass . PropertyClosureCollection ) ;
216
217
return retVal ;
217
218
}
218
219
}
@@ -234,8 +235,8 @@ public override ICollection TableClosureCollection
234
235
get
235
236
{
236
237
ArrayList retVal = new ArrayList ( ) ;
237
- retVal . AddRange ( Superclass . TableClosureCollection ) ;
238
- retVal . Add ( Table ) ;
238
+ retVal . AddRange ( Superclass . TableClosureCollection ) ;
239
+ retVal . Add ( Table ) ;
239
240
return retVal ;
240
241
}
241
242
}
@@ -248,10 +249,10 @@ public override ICollection TableClosureCollection
248
249
/// This also adds the <see cref="Property"/> to the Superclass' collection
249
250
/// of Subclass Properties.
250
251
/// </remarks>
251
- public override void AddSubclassProperty ( Property p )
252
+ public override void AddSubclassProperty ( Property p )
252
253
{
253
- base . AddSubclassProperty ( p ) ;
254
- Superclass . AddSubclassProperty ( p ) ;
254
+ base . AddSubclassProperty ( p ) ;
255
+ Superclass . AddSubclassProperty ( p ) ;
255
256
}
256
257
257
258
/// <summary>
@@ -262,10 +263,10 @@ public override void AddSubclassProperty( Property p )
262
263
/// This also adds the <see cref="Table"/> to the Superclass' collection
263
264
/// of Subclass Tables.
264
265
/// </remarks>
265
- public override void AddSubclassTable ( Table table )
266
+ public override void AddSubclassTable ( Table table )
266
267
{
267
- base . AddSubclassTable ( table ) ;
268
- Superclass . AddSubclassTable ( table ) ;
268
+ base . AddSubclassTable ( table ) ;
269
+ Superclass . AddSubclassTable ( table ) ;
269
270
}
270
271
271
272
/// <summary>
@@ -323,7 +324,7 @@ public override SimpleValue Key
323
324
{
324
325
get
325
326
{
326
- if ( key == null )
327
+ if ( key == null )
327
328
{
328
329
return Identifier ;
329
330
}
@@ -360,7 +361,7 @@ public override bool IsExplicitPolymorphism
360
361
public override string Where
361
362
{
362
363
get { return Superclass . Where ; }
363
- set { throw new InvalidOperationException ( "The Where string can not be set on the Subclass - use the RootClass instead." ) ; }
364
+ set { throw new InvalidOperationException ( "The Where string can not be set on the Subclass - use the RootClass instead." ) ; }
364
365
}
365
366
366
367
/// <summary>
@@ -376,40 +377,50 @@ public override bool IsJoinedSubclass
376
377
/// </summary>
377
378
public override bool IsDiscriminatorInsertable
378
379
{
379
- get { return Superclass . IsDiscriminatorInsertable ; }
380
- set { throw new InvalidOperationException ( "The DiscriminatorInsertable property can not be set on the Subclass - use the Superclass instead." ) ; }
380
+ get { return Superclass . IsDiscriminatorInsertable ; }
381
+ set { throw new InvalidOperationException ( "The DiscriminatorInsertable property can not be set on the Subclass - use the Superclass instead." ) ; }
381
382
}
382
383
383
384
/// <summary>
384
385
///
385
386
/// </summary>
386
387
/// <param name="mapping"></param>
387
- public override void Validate ( IMapping mapping )
388
+ public override void Validate ( IMapping mapping )
388
389
{
389
- base . Validate ( mapping ) ;
390
- if ( Key != null && ! Key . IsValid ( mapping ) )
390
+ base . Validate ( mapping ) ;
391
+ if ( Key != null && ! Key . IsValid ( mapping ) )
391
392
{
392
- throw new MappingException ( string . Format ( "subclass key has wrong number of columns: {0} type: {1}" , MappedClass . Name , Key . Type . Name ) ) ;
393
+ throw new MappingException ( string . Format ( "subclass key has wrong number of columns: {0} type: {1}" , MappedClass . Name , Key . Type . Name ) ) ;
393
394
}
394
395
}
395
396
396
397
/// <summary>
397
398
///
398
399
/// </summary>
399
- public void CreateForeignKey ( )
400
+ public void CreateForeignKey ( )
400
401
{
401
- if ( ! IsJoinedSubclass )
402
+ if ( ! IsJoinedSubclass )
402
403
{
403
- throw new AssertionFailure ( "Not a joined-subclass" ) ;
404
+ throw new AssertionFailure ( "Not a joined-subclass" ) ;
404
405
}
405
406
406
- Key . CreateForeignKeyOfClass ( Superclass . MappedClass ) ;
407
+ Key . CreateForeignKeyOfClass ( Superclass . MappedClass ) ;
407
408
}
408
409
409
410
public override int PropertyClosureSpan
410
411
{
411
412
get { return Superclass . PropertyClosureSpan + base . PropertyClosureSpan ; }
412
413
}
413
414
415
+ public override ISet SynchronizedTables
416
+ {
417
+ get
418
+ {
419
+ HashedSet result = new HashedSet ( ) ;
420
+ result . AddAll ( synchronizedTablesField ) ;
421
+ result . AddAll ( Superclass . SynchronizedTables ) ;
422
+ return result ;
423
+ }
424
+ }
414
425
}
415
426
}
0 commit comments