Skip to content

Commit 777ca5b

Browse files
committed
First round of removing use of persistent non-generic collections from the test suite.
1 parent 38164e7 commit 777ca5b

File tree

13 files changed

+128
-118
lines changed

13 files changed

+128
-118
lines changed

src/NHibernate.DomainModel/Baz.cs

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ public class Baz : INamed, IComparable
2121
private Int32 _count;
2222
private String _name;
2323
private Foo _foo;
24-
private IList _stringList;
25-
private IList _fees;
26-
private IList _customs;
27-
private IList _topComponents;
28-
private IDictionary _fooToGlarch;
29-
private IDictionary _fooComponentToFoo;
30-
private IDictionary _glarchToFoo;
31-
private IDictionary _stringDateMap;
32-
private IDictionary _topGlarchez;
33-
private IDictionary _cachedMap;
34-
private IDictionary _stringGlarchMap;
35-
private IDictionary _anyToAny;
36-
private IList _manyToAny;
24+
private IList<string> _stringList;
25+
private IList<Fee> _fees;
26+
private IList<string[]> _customs;
27+
private IList<FooComponent> _topComponents;
28+
private IDictionary<Foo, GlarchProxy> _fooToGlarch;
29+
private IDictionary<FooComponent, Foo> _fooComponentToFoo;
30+
private IDictionary<Foo, GlarchProxy> _glarchToFoo;
31+
private IDictionary<string, DateTime?> _stringDateMap;
32+
private IDictionary<char, GlarchProxy> _topGlarchez;
33+
private IDictionary<Baz, CompositeElement> _cachedMap;
34+
private IDictionary<string, Glarch> _stringGlarchMap;
35+
private IDictionary<object, object> _anyToAny;
36+
private IList<object> _manyToAny;
3737
private ISet<FooProxy> _fooSet;
3838
private ISet<string> _stringSet;
3939
private ISet<Bar> _topFoos;
4040
private ISet<BarProxy> _cascadingBars;
4141
private ISet<CompositeElement> _cached;
4242
private ISet<Sortable> _sortablez;
43-
private IList _bag;
44-
private IList _fooBag;
45-
private IList _idFooBag;
46-
private IList _byteBag;
47-
private IList _bazez;
48-
private IList _parts;
43+
private IList<string> _bag;
44+
private IList<Foo> _fooBag;
45+
private IList<Foo> _idFooBag;
46+
private IList<byte[]> _byteBag;
47+
private IList<Baz> _bazez;
48+
private IList<Part> _parts;
4949

5050
#endregion
5151

@@ -110,7 +110,7 @@ public Foo Foo
110110
/// <summary>
111111
/// Get/set for stringList
112112
/// </summary>
113-
public IList StringList
113+
public IList<string> StringList
114114
{
115115
get { return this._stringList; }
116116
set { this._stringList = value; }
@@ -119,7 +119,7 @@ public IList StringList
119119
/// <summary>
120120
/// Get/set for fees
121121
/// </summary>
122-
public IList Fees
122+
public IList<Fee> Fees
123123
{
124124
get { return _fees; }
125125
set { _fees = value; }
@@ -128,7 +128,7 @@ public IList Fees
128128
/// <summary>
129129
/// Get/set for customs
130130
/// </summary>
131-
public IList Customs
131+
public IList<string[]> Customs
132132
{
133133
get { return this._customs; }
134134
set { this._customs = value; }
@@ -137,7 +137,7 @@ public IList Customs
137137
/// <summary>
138138
/// Get/set for topComponents
139139
/// </summary>
140-
public IList TopComponents
140+
public IList<FooComponent> TopComponents
141141
{
142142
get { return this._topComponents; }
143143
set { this._topComponents = value; }
@@ -146,7 +146,7 @@ public IList TopComponents
146146
/// <summary>
147147
/// Get/set for fooToGlarch
148148
/// </summary>
149-
public IDictionary FooToGlarch
149+
public IDictionary<Foo, GlarchProxy> FooToGlarch
150150
{
151151
get { return this._fooToGlarch; }
152152
set { this._fooToGlarch = value; }
@@ -155,7 +155,7 @@ public IDictionary FooToGlarch
155155
/// <summary>
156156
/// Get/set for fooComponentToFoo
157157
/// </summary>
158-
public IDictionary FooComponentToFoo
158+
public IDictionary<FooComponent, Foo> FooComponentToFoo
159159
{
160160
get { return this._fooComponentToFoo; }
161161
set { this._fooComponentToFoo = value; }
@@ -164,7 +164,7 @@ public IDictionary FooComponentToFoo
164164
/// <summary>
165165
/// Get/set for glarchToFoo
166166
/// </summary>
167-
public IDictionary GlarchToFoo
167+
public IDictionary<Foo, GlarchProxy> GlarchToFoo
168168
{
169169
get { return this._glarchToFoo; }
170170
set { this._glarchToFoo = value; }
@@ -173,7 +173,7 @@ public IDictionary GlarchToFoo
173173
/// <summary>
174174
/// Get/set for stringDateMap
175175
/// </summary>
176-
public IDictionary StringDateMap
176+
public IDictionary<string, DateTime?> StringDateMap
177177
{
178178
get { return this._stringDateMap; }
179179
set { this._stringDateMap = value; }
@@ -182,7 +182,7 @@ public IDictionary StringDateMap
182182
/// <summary>
183183
/// Get/set for topGlarchez
184184
/// </summary>
185-
public IDictionary TopGlarchez
185+
public IDictionary<char, GlarchProxy> TopGlarchez
186186
{
187187
get { return this._topGlarchez; }
188188
set { this._topGlarchez = value; }
@@ -191,7 +191,7 @@ public IDictionary TopGlarchez
191191
/// <summary>
192192
/// Get/set for cachedMap
193193
/// </summary>
194-
public IDictionary CachedMap
194+
public IDictionary<Baz,CompositeElement> CachedMap
195195
{
196196
get { return this._cachedMap; }
197197
set { this._cachedMap = value; }
@@ -200,7 +200,7 @@ public IDictionary CachedMap
200200
/// <summary>
201201
/// Get/set for stringGlarchMap
202202
/// </summary>
203-
public IDictionary StringGlarchMap
203+
public IDictionary<string, Glarch> StringGlarchMap
204204
{
205205
get { return this._stringGlarchMap; }
206206
set { this._stringGlarchMap = value; }
@@ -209,7 +209,7 @@ public IDictionary StringGlarchMap
209209
/// <summary>
210210
/// Get/set for anyToAny
211211
/// </summary>
212-
public IDictionary AnyToAny
212+
public IDictionary<object, object> AnyToAny
213213
{
214214
get { return this._anyToAny; }
215215
set { this._anyToAny = value; }
@@ -218,7 +218,7 @@ public IDictionary AnyToAny
218218
/// <summary>
219219
/// Get/set for manyToAny
220220
/// </summary>
221-
public IList ManyToAny
221+
public IList<object> ManyToAny
222222
{
223223
get { return this._manyToAny; }
224224
set { this._manyToAny = value; }
@@ -328,7 +328,7 @@ public ISet<Sortable> Sortablez
328328
/// <summary>
329329
/// Get/set for bag
330330
/// </summary>
331-
public IList Bag
331+
public IList<string> Bag
332332
{
333333
get { return this._bag; }
334334
set { this._bag = value; }
@@ -337,7 +337,7 @@ public IList Bag
337337
/// <summary>
338338
/// Get/set for fooBag
339339
/// </summary>
340-
public IList FooBag
340+
public IList<Foo> FooBag
341341
{
342342
get { return this._fooBag; }
343343
set { this._fooBag = value; }
@@ -346,7 +346,7 @@ public IList FooBag
346346
/// <summary>
347347
/// Get/set for bazez
348348
/// </summary>
349-
public IList Bazez
349+
public IList<Baz> Bazez
350350
{
351351
get { return this._bazez; }
352352
set { this._bazez = value; }
@@ -355,7 +355,7 @@ public IList Bazez
355355
/// <summary>
356356
/// Get/set for idFooBag
357357
/// </summary>
358-
public IList IdFooBag
358+
public IList<Foo> IdFooBag
359359
{
360360
get { return this._idFooBag; }
361361
set { this._idFooBag = value; }
@@ -364,7 +364,7 @@ public IList IdFooBag
364364
/// <summary>
365365
/// Get/set for byteBag
366366
/// </summary>
367-
public IList ByteBag
367+
public IList<byte[]> ByteBag
368368
{
369369
get { return this._byteBag; }
370370
set { this._byteBag = value; }
@@ -373,7 +373,7 @@ public IList ByteBag
373373
/// <summary>
374374
/// Get/set for parts
375375
/// </summary>
376-
public IList Parts
376+
public IList<Part> Parts
377377
{
378378
get { return this._parts; }
379379
set { this._parts = value; }
@@ -387,18 +387,18 @@ public void SetDefaults()
387387

388388
StringSet = new HashSet<string> {"foo", "bar", "baz"};
389389

390-
StringDateMap = new SortedList();
390+
StringDateMap = new SortedList<string, DateTime?>();
391391
StringDateMap.Add("now", DateTime.Now);
392392
StringDateMap.Add("never", null); // value is persisted since NH-2199
393393
// according to SQL Server the big bag happened in 1753 ;)
394394
StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
395395
//StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
396396
StringArray = StringSet.ToArray();
397-
StringList = new ArrayList(StringArray);
397+
StringList = new List<string>(StringArray);
398398
IntArray = new int[] {1, 3, 3, 7};
399399
FooArray = new Foo[0];
400400

401-
Customs = new ArrayList();
401+
Customs = new List<string[]>();
402402
Customs.Add(new String[] {"foo", "bar"});
403403
Customs.Add(new String[] {"A", "B"});
404404
Customs.Add(new String[] {"1", "2"});
@@ -419,12 +419,12 @@ public void SetDefaults()
419419

420420
Count = 667;
421421
Name = "Bazza";
422-
TopComponents = new ArrayList();
422+
TopComponents = new List<FooComponent>();
423423
TopComponents.Add(new FooComponent("foo", 11, new DateTime[] {today, new DateTime(2123, 1, 1)}, null));
424424
TopComponents.Add(
425425
new FooComponent("bar", 22, new DateTime[] {new DateTime(2007, 2, 3), new DateTime(1945, 6, 1)}, null));
426426
TopComponents.Add(null);
427-
Bag = new ArrayList();
427+
Bag = new List<string>();
428428
Bag.Add("duplicate");
429429
Bag.Add("duplicate");
430430
Bag.Add("duplicate");
@@ -440,7 +440,7 @@ public void SetDefaults()
440440
ce2.Bar = "barxxx";
441441
Cached.Add(ce);
442442
Cached.Add(ce2);
443-
CachedMap = new SortedList();
443+
CachedMap = new SortedList<Baz, CompositeElement>();
444444
CachedMap.Add(this, ce);
445445
}
446446

src/NHibernate.DomainModel/Baz.hbm.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@
199199
<element column="element" type="String" not-null="true" length="32"/>
200200
</set>
201201

202-
<map name="StringDateMap" lazy="true" sort="ReverseComparator">
202+
<map name="StringDateMap" lazy="true" sort="ReverseComparator" collection-type="sorted-list">
203203
<key column="id_"/>
204204
<index column="map_key" type="String" length="32"/>
205-
<element column="map_value" type="DateTime"/>
205+
<element column="map_value" type="DateTime" />
206206
</map>
207207

208208
<array name="FooArray" element-class="FooProxy" where="i&lt;8">
@@ -295,7 +295,7 @@
295295
</composite-element>
296296
</set>
297297

298-
<map name="CachedMap" sort="natural" table="cached_map">
298+
<map name="CachedMap" sort="natural" table="cached_map" collection-type="sorted-list">
299299
<!--<cache usage="read-write"/>-->
300300
<key column="baz"/>
301301
<index-many-to-many column="another_baz" class="Baz"/>

src/NHibernate.DomainModel/C2.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections;
3+
using System.Collections.Generic;
34

45
namespace NHibernate.DomainModel
56
{
@@ -27,7 +28,7 @@ public class C2 : B
2728
/// <summary>
2829
/// Holder for c1s
2930
/// </summary>
30-
private IList _c1s = new ArrayList();
31+
private IList<C1> _c1s = new List<C1>();
3132

3233
#endregion
3334

@@ -81,7 +82,7 @@ public virtual C1 C1
8182
set { _c1 = value; }
8283
}
8384

84-
public virtual IList C1s
85+
public virtual IList<C1> C1s
8586
{
8687
get { return _c1s; }
8788
set { _c1s = value; }

src/NHibernate.DomainModel/NHSpecific/BasicClass.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public class BasicClass
3030

3131
private string[] _stringArray;
3232
private int[] _int32Array;
33-
private IList _stringBag;
34-
private IList _stringList;
35-
private IDictionary _stringMap;
33+
private IList<string> _stringBag;
34+
private IList<string> _stringList;
35+
private IDictionary<string, string> _stringMap;
3636
private IDictionary<string, string> _stringMapGeneric;
3737
private ISet<string> _stringSet;
3838

@@ -150,19 +150,19 @@ public int[] Int32Array
150150
set { _int32Array = value; }
151151
}
152152

153-
public IList StringBag
153+
public IList<string> StringBag
154154
{
155155
get { return _stringBag; }
156156
set { _stringBag = value; }
157157
}
158158

159-
public IList StringList
159+
public IList<string> StringList
160160
{
161161
get { return _stringList; }
162162
set { _stringList = value; }
163163
}
164164

165-
public IDictionary StringMap
165+
public IDictionary<string, string> StringMap
166166
{
167167
get { return _stringMap; }
168168
set { _stringMap = value; }

src/NHibernate.DomainModel/ReverseComparator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
using System;
2-
using System.Collections;
2+
using System.Collections.Generic;
33

44
namespace NHibernate.DomainModel
55
{
66
[Serializable]
7-
public class ReverseComparator : IComparer
7+
public class ReverseComparator : IComparer<string>
88
{
99
#region IComparer Members
1010

11-
public int Compare(object x, object y)
11+
public int Compare(string x, string y)
1212
{
13-
return - ((IComparable) x).CompareTo(y);
13+
return - (x).CompareTo(y);
1414
}
1515

1616
#endregion

src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections;
3+
using System.Collections.Generic;
34
using System.Data;
45
using NHibernate.Cfg;
56
using NHibernate.Util;
@@ -218,7 +219,7 @@ public void ConnectionMaintanenceDuringFlush()
218219
ISession s = GetSessionUnderTest();
219220
s.BeginTransaction();
220221

221-
IList entities = new ArrayList();
222+
IList<Silly> entities = new List<Silly>();
222223
for (int i = 0; i < 10; i++)
223224
{
224225
Other other = new Other("other-" + i);

0 commit comments

Comments
 (0)