Skip to content

Commit c03bd05

Browse files
author
Mike Doerfler
committed
NHibernate is now CLSCompliant
SVN: trunk@1093
1 parent 15e0197 commit c03bd05

24 files changed

+226
-225
lines changed

src/NHibernate/AssemblyInfo.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Reflection;
23
using System.Runtime.CompilerServices;
34

@@ -11,6 +12,7 @@
1112
// </autogenerated>
1213
//------------------------------------------------------------------------------
1314

15+
[assembly: CLSCompliantAttribute(true)]
1416
[assembly: AssemblyTitleAttribute("NHibernate for Microsoft .NET Framework 1.1")]
1517
[assembly: AssemblyDescriptionAttribute("An object persistence library for relational databases.")]
1618
[assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")]

src/NHibernate/Collection/Set.cs

+36-52
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace NHibernate.Collection
1919
[Serializable]
2020
public class Set : PersistentCollection, Iesi.Collections.ISet
2121
{
22-
protected Iesi.Collections.ISet _set;
22+
protected Iesi.Collections.ISet internalSet;
2323

2424
[NonSerialized] protected IList tempIdentifierList;
2525

@@ -30,8 +30,8 @@ public class Set : PersistentCollection, Iesi.Collections.ISet
3030
/// </summary>
3131
protected override object Snapshot(CollectionPersister persister)
3232
{
33-
Hashtable clonedMap = new Hashtable( _set.Count );
34-
foreach( object obj in _set )
33+
Hashtable clonedMap = new Hashtable( internalSet.Count );
34+
foreach( object obj in internalSet )
3535
{
3636
object copied = persister.ElementType.DeepCopy( obj );
3737
clonedMap[ copied ] = copied;
@@ -44,7 +44,7 @@ public override ICollection GetOrphans(object snapshot)
4444
IDictionary sn = (IDictionary)snapshot;
4545
ArrayList result = new ArrayList(sn.Keys.Count);
4646
result.AddRange(sn.Keys);
47-
PersistentCollection.IdentityRemoveAll( result,_set, session );
47+
PersistentCollection.IdentityRemoveAll( result, internalSet, session );
4848
return result;
4949
}
5050

@@ -54,13 +54,13 @@ public override ICollection GetOrphans(object snapshot)
5454
public override bool EqualsSnapshot(IType elementType)
5555
{
5656
IDictionary snapshot = (IDictionary) GetSnapshot();
57-
if ( snapshot.Count!= _set.Count )
57+
if ( snapshot.Count!= internalSet.Count )
5858
{
5959
return false;
6060
}
6161
else
6262
{
63-
foreach( object obj in _set )
63+
foreach( object obj in internalSet )
6464
{
6565
object oldValue = snapshot[ obj ];
6666
if ( oldValue==null || elementType.IsDirty( oldValue, obj, session))
@@ -85,7 +85,7 @@ public Set(ISessionImplementor session) : base(session) { }
8585
/// </remarks>
8686
public Set(ISessionImplementor session, Iesi.Collections.ISet collection) : base(session)
8787
{
88-
_set = collection;
88+
internalSet = collection;
8989
initialized = true;
9090
directlyAccessible = true;
9191
}
@@ -97,7 +97,7 @@ public Set(ISessionImplementor session, CollectionPersister persister, object di
9797
object[] array = (object[]) disassembled;
9898
for (int i=0; i<array.Length; i+=2)
9999
{
100-
_set.Add( persister.ElementType.Assemble( array[i], session, owner ) );
100+
internalSet.Add( persister.ElementType.Assemble( array[i], session, owner ) );
101101
}
102102
initialized = true;
103103
}
@@ -109,11 +109,11 @@ public override void BeforeInitialize(CollectionPersister persister) {
109109

110110
if(persister.HasOrdering)
111111
{
112-
_set = new Iesi.Collections.ListSet();
112+
internalSet = new Iesi.Collections.ListSet();
113113
}
114114
else
115115
{
116-
_set = new Iesi.Collections.HashedSet();
116+
internalSet = new Iesi.Collections.HashedSet();
117117
}
118118
}
119119

@@ -127,7 +127,7 @@ public override void BeforeInitialize(CollectionPersister persister) {
127127
public override void CopyTo(System.Array array, int index)
128128
{
129129
Read();
130-
_set.CopyTo( array, index );
130+
internalSet.CopyTo( array, index );
131131
}
132132

133133
/// <summary>
@@ -138,7 +138,7 @@ public override int Count
138138
get
139139
{
140140
Read();
141-
return _set.Count;
141+
return internalSet.Count;
142142
}
143143
}
144144

@@ -165,96 +165,80 @@ public override object SyncRoot
165165
public bool Add(object value)
166166
{
167167
Write();
168-
return _set.Add( value );
168+
return internalSet.Add( value );
169169
}
170170

171171
public void Clear()
172172
{
173173
Write();
174-
_set.Clear();
174+
internalSet.Clear();
175175
}
176176

177177
public bool Contains(object key)
178178
{
179179
Read();
180-
return _set.Contains( key );
180+
return internalSet.Contains( key );
181181
}
182182

183183
public bool ContainsAll(ICollection c)
184184
{
185185
Read();
186-
return _set.ContainsAll( c );
186+
return internalSet.ContainsAll( c );
187187
}
188188

189189
public Iesi.Collections.ISet ExclusiveOr(Iesi.Collections.ISet a)
190190
{
191191
Read();
192-
return _set.ExclusiveOr( a );
192+
return internalSet.ExclusiveOr( a );
193193
}
194194

195195
public Iesi.Collections.ISet Intersect(Iesi.Collections.ISet a)
196196
{
197197
Read();
198-
return _set.Intersect( a );
198+
return internalSet.Intersect( a );
199199
}
200200

201201
public bool IsEmpty
202202
{
203203
get
204204
{
205205
Read();
206-
return _set.IsEmpty;
206+
return internalSet.IsEmpty;
207207
}
208208
}
209209

210210
public Iesi.Collections.ISet Minus(Iesi.Collections.ISet a)
211211
{
212212
Read();
213-
return _set.Minus( a );
213+
return internalSet.Minus( a );
214214
}
215215

216216
public bool Remove(object key)
217217
{
218218
Write();
219-
return _set.Remove( key );
219+
return internalSet.Remove( key );
220220
}
221221

222222
public bool RemoveAll(ICollection c)
223223
{
224224
Write();
225-
return _set.RemoveAll( c );
225+
return internalSet.RemoveAll( c );
226226
}
227227

228228
public bool RetainAll(ICollection c)
229229
{
230230
Write();
231-
return _set.RetainAll( c );
231+
return internalSet.RetainAll( c );
232232
}
233233

234234
public Iesi.Collections.ISet Union(Iesi.Collections.ISet a)
235235
{
236236
Read();
237-
return _set.Union( a );
237+
return internalSet.Union( a );
238238
}
239239

240240
#endregion
241241

242-
// /// <summary>
243-
// /// <see cref="IDictionary.IsFixedSize"/>
244-
// /// </summary>
245-
// public bool IsFixedSize
246-
// {
247-
// get { return false; }
248-
// }
249-
//
250-
// /// <summary>
251-
// /// <see cref="IDictionary.IsReadOnly"/>
252-
// /// </summary>
253-
// public bool IsReadOnly
254-
// {
255-
// get { return false; }
256-
// }
257-
258242
#region System.Collections.IEnumerable Members
259243

260244
/// <summary>
@@ -263,7 +247,7 @@ public Iesi.Collections.ISet Union(Iesi.Collections.ISet a)
263247
public override IEnumerator GetEnumerator()
264248
{
265249
Read();
266-
return _set.GetEnumerator();
250+
return internalSet.GetEnumerator();
267251
}
268252

269253
#endregion
@@ -274,7 +258,7 @@ public override IEnumerator GetEnumerator()
274258
public object Clone()
275259
{
276260
Read();
277-
return _set.Clone();
261+
return internalSet.Clone();
278262
}
279263

280264
#endregion
@@ -284,21 +268,21 @@ public object Clone()
284268
/// </summary>
285269
public override ICollection Elements()
286270
{
287-
return _set;
271+
return internalSet;
288272
}
289273

290274
/// <summary>
291275
/// <see cref="PersistentCollection.Empty"/>
292276
/// </summary>
293277
public override bool Empty
294278
{
295-
get { return _set.Count==0; }
279+
get { return internalSet.Count==0; }
296280
}
297281

298282
public override string ToString()
299283
{
300284
Read();
301-
return _set.ToString();
285+
return internalSet.ToString();
302286
}
303287

304288

@@ -307,7 +291,7 @@ public override string ToString()
307291
/// </summary>
308292
public override void WriteTo(IDbCommand st, CollectionPersister persister, object entry, int i, bool writeOrder)
309293
{
310-
persister.WriteElement(st, entry, writeOrder, session);
294+
persister.WriteElement( st, entry, writeOrder, session );
311295
}
312296

313297
/// <summary>
@@ -341,7 +325,7 @@ public override void EndRead(CollectionPersister persister, object owner)
341325
foreach(object identifier in tempIdentifierList)
342326
{
343327
object element = persister.ElementType.ResolveIdentifier(identifier, session, owner);
344-
_set.Add( element );
328+
internalSet.Add( element );
345329
}
346330

347331
}
@@ -351,7 +335,7 @@ public override void EndRead(CollectionPersister persister, object owner)
351335
/// </summary>
352336
public override ICollection Entries()
353337
{
354-
return _set;
338+
return internalSet;
355339
}
356340

357341

@@ -360,10 +344,10 @@ public override ICollection Entries()
360344
/// </summary>
361345
public override object Disassemble(CollectionPersister persister)
362346
{
363-
object[] result = new object[ _set.Count ];
347+
object[] result = new object[ internalSet.Count ];
364348
int i=0;
365349

366-
foreach( object obj in _set )
350+
foreach( object obj in internalSet )
367351
{
368352
result[i++] = persister.ElementType.Disassemble( obj, session );
369353
}
@@ -382,14 +366,14 @@ public override ICollection GetDeletes(IType elemType)
382366
{
383367
object test = e.Key;
384368

385-
if( _set.Contains( test )==false )
369+
if( internalSet.Contains( test )==false )
386370
{
387371
deletes.Add( test );
388372
}
389373

390374
}
391375

392-
foreach(object obj in _set)
376+
foreach(object obj in internalSet)
393377
{
394378
//object testKey = e.Key;
395379
object oldKey = snapshot[ obj ];

src/NHibernate/Collection/SortedSet.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class SortedSet : Set, Iesi.Collections.ISet
2121

2222
protected override object Snapshot(CollectionPersister persister)
2323
{
24-
SortedList clonedSet = new SortedList(comparer, _set.Count);
25-
foreach(object obj in _set)
24+
SortedList clonedSet = new SortedList(comparer, internalSet.Count);
25+
foreach(object obj in internalSet)
2626
{
2727
object copy = persister.ElementType.DeepCopy( obj );
2828
clonedSet.Add(copy, copy);
@@ -39,7 +39,7 @@ public IComparer Comparer
3939

4040
public override void BeforeInitialize(CollectionPersister persister)
4141
{
42-
_set = new Iesi.Collections.SortedSet( Comparer );
42+
internalSet = new Iesi.Collections.SortedSet( Comparer );
4343
// an ArrayList of the identifiers is what Set uses because there is not
4444
// both a Key & Value to worry about - just the Key.
4545
this.tempIdentifierList = new ArrayList();
@@ -74,7 +74,7 @@ public SortedSet(ISessionImplementor session, CollectionPersister persister, ICo
7474
for(int i = 0; i < array.Length; i++)
7575
{
7676
object newObject = persister.ElementType.Assemble(array[i], session, owner);
77-
_set.Add( newObject );
77+
internalSet.Add( newObject );
7878
}
7979

8080
initialized = true;

src/NHibernate/Connection/ConnectionProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class ConnectionProvider : IConnectionProvider, IDisposable
1414
{
1515
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ConnectionProvider));
1616
private string connString = null;
17-
protected IDriver driver = null;
17+
private IDriver driver = null;
1818

1919
public virtual void CloseConnection(IDbConnection conn)
2020
{

src/NHibernate/Hql/FilterTranslator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public FilterTranslator(Dialect.Dialect d) : base(d)
2020
[MethodImpl(MethodImplOptions.Synchronized)]
2121
public void Compile(string collectionRole, ISessionFactoryImplementor factory, string queryString, IDictionary replacements, bool scalar)
2222
{
23-
if (!compiled)
23+
if (!Compiled)
2424
{
2525
this.factory = factory; // yick!
2626
AddFromCollection("this", collectionRole);

src/NHibernate/Hql/PathExpressionParser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class PathExpressionParser : IParser
4343
protected QueryJoinFragment join;
4444
protected string[] columns;
4545
protected string[] collectionElementColumns;
46-
protected string collectionName;
46+
private string collectionName; //protected
4747
private string collectionOwnerName;
4848
private string collectionRole;
4949
private string collectionTable;

0 commit comments

Comments
 (0)