@@ -25,7 +25,7 @@ namespace NHibernate.Collection.Generic
2525 [ DebuggerTypeProxy ( typeof ( DictionaryProxy < , > ) ) ]
2626 public partial class PersistentGenericMap < TKey , TValue > : AbstractPersistentCollection , IDictionary < TKey , TValue > , ICollection
2727 {
28- private IDictionary < TKey , TValue > _wrappedMap ;
28+ protected IDictionary < TKey , TValue > WrappedMap ;
2929 private readonly ICollection < TValue > _wrappedValues ;
3030
3131 public PersistentGenericMap ( )
@@ -50,16 +50,16 @@ public PersistentGenericMap(ISessionImplementor session) : base(session)
5050 public PersistentGenericMap ( ISessionImplementor session , IDictionary < TKey , TValue > map )
5151 : base ( session )
5252 {
53- _wrappedMap = map ;
53+ WrappedMap = map ;
5454 _wrappedValues = new ValuesWrapper ( this ) ;
5555 SetInitialized ( ) ;
5656 IsDirectlyAccessible = true ;
5757 }
5858
5959 public override object GetSnapshot ( ICollectionPersister persister )
6060 {
61- Dictionary < TKey , TValue > clonedMap = new Dictionary < TKey , TValue > ( _wrappedMap . Count ) ;
62- foreach ( KeyValuePair < TKey , TValue > e in _wrappedMap )
61+ Dictionary < TKey , TValue > clonedMap = new Dictionary < TKey , TValue > ( WrappedMap . Count ) ;
62+ foreach ( KeyValuePair < TKey , TValue > e in WrappedMap )
6363 {
6464 object copy = persister . ElementType . DeepCopy ( e . Value , persister . Factory ) ;
6565 clonedMap [ e . Key ] = ( TValue ) copy ;
@@ -70,18 +70,18 @@ public override object GetSnapshot(ICollectionPersister persister)
7070 public override ICollection GetOrphans ( object snapshot , string entityName )
7171 {
7272 var sn = ( IDictionary < TKey , TValue > ) snapshot ;
73- return GetOrphans ( ( ICollection ) sn . Values , ( ICollection ) _wrappedMap . Values , entityName , Session ) ;
73+ return GetOrphans ( ( ICollection ) sn . Values , ( ICollection ) WrappedMap . Values , entityName , Session ) ;
7474 }
7575
7676 public override bool EqualsSnapshot ( ICollectionPersister persister )
7777 {
7878 IType elementType = persister . ElementType ;
7979 var xmap = ( IDictionary < TKey , TValue > ) GetSnapshot ( ) ;
80- if ( xmap . Count != _wrappedMap . Count )
80+ if ( xmap . Count != WrappedMap . Count )
8181 {
8282 return false ;
8383 }
84- foreach ( KeyValuePair < TKey , TValue > entry in _wrappedMap )
84+ foreach ( KeyValuePair < TKey , TValue > entry in WrappedMap )
8585 {
8686 // This method is not currently called if a key has been removed/added, but better be on the safe side.
8787 if ( ! xmap . TryGetValue ( entry . Key , out var value ) ||
@@ -100,23 +100,23 @@ public override bool IsSnapshotEmpty(object snapshot)
100100
101101 public override bool IsWrapper ( object collection )
102102 {
103- return _wrappedMap == collection ;
103+ return WrappedMap == collection ;
104104 }
105105
106106 public override void BeforeInitialize ( ICollectionPersister persister , int anticipatedSize )
107107 {
108- _wrappedMap = ( IDictionary < TKey , TValue > ) persister . CollectionType . Instantiate ( anticipatedSize ) ;
108+ WrappedMap = ( IDictionary < TKey , TValue > ) persister . CollectionType . Instantiate ( anticipatedSize ) ;
109109 }
110110
111111 public override bool Empty
112112 {
113- get { return ( _wrappedMap . Count == 0 ) ; }
113+ get { return ( WrappedMap . Count == 0 ) ; }
114114 }
115115
116116 public override string ToString ( )
117117 {
118118 Read ( ) ;
119- return StringHelper . CollectionToString ( _wrappedMap ) ;
119+ return StringHelper . CollectionToString ( WrappedMap ) ;
120120 }
121121
122122 public override object ReadFrom ( DbDataReader rs , ICollectionPersister role , ICollectionAliases descriptor , object owner )
@@ -130,12 +130,12 @@ public override object ReadFrom(DbDataReader rs, ICollectionPersister role, ICol
130130
131131 protected virtual void AddDuringInitialize ( object index , object element )
132132 {
133- _wrappedMap [ ( TKey ) index ] = ( TValue ) element ;
133+ WrappedMap [ ( TKey ) index ] = ( TValue ) element ;
134134 }
135135
136136 public override IEnumerable Entries ( ICollectionPersister persister )
137137 {
138- return _wrappedMap ;
138+ return WrappedMap ;
139139 }
140140
141141 /// <summary>
@@ -151,16 +151,16 @@ public override void InitializeFromCache(ICollectionPersister persister, object
151151 BeforeInitialize ( persister , size ) ;
152152 for ( int i = 0 ; i < size ; i += 2 )
153153 {
154- _wrappedMap [ ( TKey ) persister . IndexType . Assemble ( array [ i ] , Session , owner ) ] =
154+ WrappedMap [ ( TKey ) persister . IndexType . Assemble ( array [ i ] , Session , owner ) ] =
155155 ( TValue ) persister . ElementType . Assemble ( array [ i + 1 ] , Session , owner ) ;
156156 }
157157 }
158158
159159 public override object Disassemble ( ICollectionPersister persister )
160160 {
161- object [ ] result = new object [ _wrappedMap . Count * 2 ] ;
161+ object [ ] result = new object [ WrappedMap . Count * 2 ] ;
162162 int i = 0 ;
163- foreach ( KeyValuePair < TKey , TValue > e in _wrappedMap )
163+ foreach ( KeyValuePair < TKey , TValue > e in WrappedMap )
164164 {
165165 result [ i ++ ] = persister . IndexType . Disassemble ( e . Key , Session , null ) ;
166166 result [ i ++ ] = persister . ElementType . Disassemble ( e . Value , Session , null ) ;
@@ -174,7 +174,7 @@ public override IEnumerable GetDeletes(ICollectionPersister persister, bool inde
174174 var sn = ( IDictionary < TKey , TValue > ) GetSnapshot ( ) ;
175175 foreach ( var e in sn )
176176 {
177- if ( ! _wrappedMap . ContainsKey ( e . Key ) )
177+ if ( ! WrappedMap . ContainsKey ( e . Key ) )
178178 {
179179 object key = e . Key ;
180180 deletes . Add ( indexIsFormula ? e . Value : key ) ;
@@ -224,18 +224,18 @@ public override bool Equals(object other)
224224 return false ;
225225 }
226226 Read ( ) ;
227- return CollectionHelper . DictionaryEquals ( _wrappedMap , that ) ;
227+ return CollectionHelper . DictionaryEquals ( WrappedMap , that ) ;
228228 }
229229
230230 public override int GetHashCode ( )
231231 {
232232 Read ( ) ;
233- return _wrappedMap . GetHashCode ( ) ;
233+ return WrappedMap . GetHashCode ( ) ;
234234 }
235235
236236 public override bool EntryExists ( object entry , int i )
237237 {
238- return _wrappedMap . ContainsKey ( ( ( KeyValuePair < TKey , TValue > ) entry ) . Key ) ;
238+ return WrappedMap . ContainsKey ( ( ( KeyValuePair < TKey , TValue > ) entry ) . Key ) ;
239239 }
240240
241241
@@ -244,7 +244,7 @@ public override bool EntryExists(object entry, int i)
244244 public bool ContainsKey ( TKey key )
245245 {
246246 bool ? exists = ReadIndexExistence ( key ) ;
247- return ! exists . HasValue ? _wrappedMap . ContainsKey ( key ) : exists . Value ;
247+ return ! exists . HasValue ? WrappedMap . ContainsKey ( key ) : exists . Value ;
248248 }
249249
250250 public void Add ( TKey key , TValue value )
@@ -263,7 +263,7 @@ public void Add(TKey key, TValue value)
263263 }
264264 }
265265 Initialize ( true ) ;
266- _wrappedMap . Add ( key , value ) ;
266+ WrappedMap . Add ( key , value ) ;
267267 Dirty ( ) ;
268268 }
269269
@@ -273,7 +273,7 @@ public bool Remove(TKey key)
273273 if ( old == Unknown ) // queue is not enabled for 'puts', or element not found
274274 {
275275 Initialize ( true ) ;
276- bool contained = _wrappedMap . Remove ( key ) ;
276+ bool contained = WrappedMap . Remove ( key ) ;
277277 if ( contained )
278278 {
279279 Dirty ( ) ;
@@ -291,7 +291,7 @@ public bool TryGetValue(TKey key, out TValue value)
291291 object result = ReadElementByIndex ( key ) ;
292292 if ( result == Unknown )
293293 {
294- return _wrappedMap . TryGetValue ( key , out value ) ;
294+ return WrappedMap . TryGetValue ( key , out value ) ;
295295 }
296296 if ( result == NotFound )
297297 {
@@ -309,7 +309,7 @@ public TValue this[TKey key]
309309 object result = ReadElementByIndex ( key ) ;
310310 if ( result == Unknown )
311311 {
312- return _wrappedMap [ key ] ;
312+ return WrappedMap [ key ] ;
313313 }
314314 if ( result == NotFound )
315315 {
@@ -331,8 +331,8 @@ public TValue this[TKey key]
331331 }
332332 Initialize ( true ) ;
333333 TValue tempObject ;
334- _wrappedMap . TryGetValue ( key , out tempObject ) ;
335- _wrappedMap [ key ] = value ;
334+ WrappedMap . TryGetValue ( key , out tempObject ) ;
335+ WrappedMap [ key ] = value ;
336336 TValue old2 = tempObject ;
337337 // would be better to use the element-type to determine
338338 // whether the old and the new are equal here; the problem being
@@ -350,7 +350,7 @@ public ICollection<TKey> Keys
350350 get
351351 {
352352 Read ( ) ;
353- return _wrappedMap . Keys ;
353+ return WrappedMap . Keys ;
354354 }
355355 }
356356
@@ -380,10 +380,10 @@ public void Clear()
380380 else
381381 {
382382 Initialize ( true ) ;
383- if ( _wrappedMap . Count != 0 )
383+ if ( WrappedMap . Count != 0 )
384384 {
385385 Dirty ( ) ;
386- _wrappedMap . Clear ( ) ;
386+ WrappedMap . Clear ( ) ;
387387 }
388388 }
389389 }
@@ -393,7 +393,7 @@ public bool Contains(KeyValuePair<TKey, TValue> item)
393393 bool ? exists = ReadIndexExistence ( item . Key ) ;
394394 if ( ! exists . HasValue )
395395 {
396- return _wrappedMap . Contains ( item ) ;
396+ return WrappedMap . Contains ( item ) ;
397397 }
398398
399399 if ( exists . Value )
@@ -441,7 +441,7 @@ public bool Remove(KeyValuePair<TKey, TValue> item)
441441
442442 public int Count
443443 {
444- get { return ReadSize ( ) ? CachedSize : _wrappedMap . Count ; }
444+ get { return ReadSize ( ) ? CachedSize : WrappedMap . Count ; }
445445 }
446446
447447 public bool IsReadOnly
@@ -475,7 +475,7 @@ public bool IsSynchronized
475475 IEnumerator < KeyValuePair < TKey , TValue > > IEnumerable < KeyValuePair < TKey , TValue > > . GetEnumerator ( )
476476 {
477477 Read ( ) ;
478- return _wrappedMap . GetEnumerator ( ) ;
478+ return WrappedMap . GetEnumerator ( ) ;
479479 }
480480
481481 #endregion
@@ -485,7 +485,7 @@ IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.
485485 IEnumerator IEnumerable . GetEnumerator ( )
486486 {
487487 Read ( ) ;
488- return _wrappedMap . GetEnumerator ( ) ;
488+ return WrappedMap . GetEnumerator ( ) ;
489489 }
490490
491491 #endregion
@@ -513,7 +513,7 @@ public object Orphan
513513
514514 public void Operate ( )
515515 {
516- _enclosingInstance . _wrappedMap . Clear ( ) ;
516+ _enclosingInstance . WrappedMap . Clear ( ) ;
517517 }
518518 }
519519
@@ -544,7 +544,7 @@ public object Orphan
544544
545545 public void Operate ( )
546546 {
547- _enclosingInstance . _wrappedMap [ _index ] = _value ;
547+ _enclosingInstance . WrappedMap [ _index ] = _value ;
548548 }
549549 }
550550
@@ -573,7 +573,7 @@ public object Orphan
573573
574574 public void Operate ( )
575575 {
576- _enclosingInstance . _wrappedMap . Remove ( _index ) ;
576+ _enclosingInstance . WrappedMap . Remove ( _index ) ;
577577 }
578578 }
579579
@@ -609,7 +609,7 @@ public ValuesWrapper(PersistentGenericMap<TKey, TValue> map)
609609 public IEnumerator < TValue > GetEnumerator ( )
610610 {
611611 _map . Read ( ) ;
612- return _map . _wrappedMap . Values . GetEnumerator ( ) ;
612+ return _map . WrappedMap . Values . GetEnumerator ( ) ;
613613 }
614614
615615 IEnumerator IEnumerable . GetEnumerator ( )
@@ -631,13 +631,13 @@ public void Clear()
631631 public bool Contains ( TValue item )
632632 {
633633 _map . Read ( ) ;
634- return _map . _wrappedMap . Values . Contains ( item ) ;
634+ return _map . WrappedMap . Values . Contains ( item ) ;
635635 }
636636
637637 public void CopyTo ( TValue [ ] array , int arrayIndex )
638638 {
639639 _map . Read ( ) ;
640- _map . _wrappedMap . Values . CopyTo ( array , arrayIndex ) ;
640+ _map . WrappedMap . Values . CopyTo ( array , arrayIndex ) ;
641641 }
642642
643643 public bool Remove ( TValue item )
@@ -650,7 +650,7 @@ public int Count
650650 get
651651 {
652652 _map . Read ( ) ;
653- return _map . _wrappedMap . Values . Count ;
653+ return _map . WrappedMap . Values . Count ;
654654 }
655655 }
656656
0 commit comments