Skip to content

Commit 016c97b

Browse files
committed
Continue removing use of persistent non-generic collections from the test suite.
1 parent 777ca5b commit 016c97b

File tree

12 files changed

+58
-56
lines changed

12 files changed

+58
-56
lines changed

src/NHibernate.DomainModel/B.cs

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

44
namespace NHibernate.DomainModel
55
{
@@ -22,7 +22,7 @@ public class B : A
2222
/// <summary>
2323
/// Holder for map
2424
/// </summary>
25-
private IDictionary _map;
25+
private IDictionary<string, string> _map;
2626

2727
#endregion
2828

@@ -41,7 +41,7 @@ public B()
4141
/// <param name="name">Initial name value</param>
4242
/// <param name="count">Initial count value</param>
4343
/// <param name="map">Initial map value</param>
44-
public B(String name, Int32 count, IDictionary map)
44+
public B(String name, Int32 count, IDictionary<string, string> map)
4545
: base(name)
4646
{
4747
this._count = count;
@@ -52,7 +52,7 @@ public B(String name, Int32 count, IDictionary map)
5252
/// Minimal constructor for class B
5353
/// </summary>
5454
/// <param name="map">Initial map value</param>
55-
public B(IDictionary map)
55+
public B(IDictionary<string, string> map)
5656
{
5757
this._map = map;
5858
}
@@ -73,7 +73,7 @@ public virtual Int32 Count
7373
/// <summary>
7474
/// Get/set for map
7575
/// </summary>
76-
public virtual IDictionary Map
76+
public virtual IDictionary<string, string> Map
7777
{
7878
get { return _map; }
7979
set { _map = value; }

src/NHibernate.DomainModel/C1.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections.Generic;
3+
44
namespace NHibernate.DomainModel
55
{
66
/// <summary>
@@ -32,7 +32,7 @@ public class C1 : B
3232
/// <summary>
3333
/// Holder for c2s
3434
/// </summary>
35-
private IList _c2s = new ArrayList();
35+
private IList<C2> _c2s = new List<C2>();
3636

3737
#endregion
3838

@@ -53,7 +53,7 @@ public C1()
5353
/// <param name="map">Initial map value</param>
5454
/// <param name="address">Initial address value</param>
5555
/// <param name="d">Initial d value</param>
56-
public C1(String name, Int32 count, IDictionary map, String address, D d)
56+
public C1(String name, Int32 count, IDictionary<string, string> map, String address, D d)
5757
: base(name, count, map)
5858
{
5959
this._address = address;
@@ -64,7 +64,7 @@ public C1(String name, Int32 count, IDictionary map, String address, D d)
6464
/// Minimal constructor for class C1
6565
/// </summary>
6666
/// <param name="map">Initial map value</param>
67-
public C1(IDictionary map)
67+
public C1(IDictionary<string, string> map)
6868
: base(map)
6969
{
7070
}
@@ -97,7 +97,7 @@ public virtual C2 C2
9797
set { _c2 = value; }
9898
}
9999

100-
public virtual IList C2s
100+
public virtual IList<C2> C2s
101101
{
102102
get { return _c2s; }
103103
set { _c2s = value; }

src/NHibernate.DomainModel/C2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public C2()
4848
/// <param name="count">Initial count value</param>
4949
/// <param name="map">Initial map value</param>
5050
/// <param name="address">Initial address value</param>
51-
public C2(String name, Int32 count, IDictionary map, String address)
51+
public C2(String name, Int32 count, IDictionary<string, string> map, String address)
5252
: base(name, count, map)
5353
{
5454
this._address = address;
@@ -58,7 +58,7 @@ public C2(String name, Int32 count, IDictionary map, String address)
5858
/// Minimal constructor for class C2
5959
/// </summary>
6060
/// <param name="map">Initial map value</param>
61-
public C2(IDictionary map)
61+
public C2(IDictionary<string, string> map)
6262
: base(map)
6363
{
6464
}

src/NHibernate.DomainModel/Category.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections.Generic;
3+
44
namespace NHibernate.DomainModel
55
{
66
/// <summary>
@@ -12,7 +12,7 @@ public class Category
1212

1313
private long _id;
1414
private string _name;
15-
private IList _subcategories = new ArrayList();
15+
private IList<Category> _subcategories = new List<Category>();
1616
private Assignable _assignable;
1717

1818
public long Id
@@ -27,7 +27,7 @@ public string Name
2727
set { _name = value; }
2828
}
2929

30-
public IList Subcategories
30+
public IList<Category> Subcategories
3131
{
3232
get { return _subcategories; }
3333
set { _subcategories = value; }

src/NHibernate.DomainModel/NHSpecific/Child.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
45
namespace NHibernate.DomainModel.NHSpecific
56
{
67
/// <summary>
@@ -10,10 +11,10 @@ public class Child
1011
{
1112
private int _id;
1213
private string _fullName;
13-
private IDictionary _parents;
14+
private IDictionary<string, Parent> _parents;
1415
private SexType _sex;
1516

16-
private IList _siblings;
17+
private IList<Child> _siblings;
1718

1819
private Child[] _friends;
1920

@@ -37,11 +38,11 @@ public string FullName
3738
set { _fullName = value; }
3839
}
3940

40-
public IList Siblings
41+
public IList<Child> Siblings
4142
{
4243
get
4344
{
44-
if (_siblings == null) _siblings = new ArrayList();
45+
if (_siblings == null) _siblings = new List<Child>();
4546
return _siblings;
4647
}
4748
set { _siblings = value; }
@@ -60,11 +61,11 @@ public Child SecondSibling
6061
set { Siblings.Insert(1, value); }
6162
}
6263

63-
public IDictionary Parents
64+
public IDictionary<string, Parent> Parents
6465
{
6566
get
6667
{
67-
if (_parents == null) _parents = new Hashtable();
68+
if (_parents == null) _parents = new Dictionary<string, Parent>();
6869
return _parents;
6970
}
7071
set { _parents = value; }
@@ -75,7 +76,7 @@ public Parent Mom
7576
get { return (Parent) Parents["mom"]; }
7677
set
7778
{
78-
if (Parents.Contains("mom") == false)
79+
if (Parents.ContainsKey("mom") == false)
7980
{
8081
Parents.Add("mom", value);
8182
}
@@ -91,7 +92,7 @@ public Parent Dad
9192
get { return (Parent) Parents["dad"]; }
9293
set
9394
{
94-
if (Parents.Contains("dad") == false)
95+
if (Parents.ContainsKey("dad") == false)
9596
{
9697
Parents.Add("dad", value);
9798
}

src/NHibernate.Test/Legacy/ABCProxyTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ public void SubclassMap()
243243
ITransaction t = s.BeginTransaction();
244244
B b = new B();
245245
s.Save(b);
246-
Hashtable map = new Hashtable();
247-
map.Add("3", 1);
246+
IDictionary<string, string> map = new Dictionary<string, string>();
247+
map.Add("3", "1");
248248
b.Map = map;
249249
s.Flush();
250250
s.Delete(b);
@@ -253,8 +253,8 @@ public void SubclassMap()
253253

254254
s = OpenSession();
255255
t = s.BeginTransaction();
256-
map = new Hashtable();
257-
map.Add("3", 1);
256+
map = new Dictionary<string, string>();
257+
map.Add("3", "1");
258258
b = new B();
259259
b.Map = map;
260260
s.Save(b);

src/NHibernate.Test/Legacy/ABCTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
2-
using System.Collections;
2+
using System.Collections;
3+
using System.Collections.Generic;
34
using NHibernate.Dialect;
45
using NHibernate.DomainModel;
56
using NUnit.Framework;
@@ -42,7 +43,7 @@ public void Subselect()
4243
using (ITransaction t = s.BeginTransaction())
4344
{
4445
B b = new B();
45-
IDictionary map = new Hashtable();
46+
IDictionary<string, string> map = new Dictionary<string, string>();
4647
map["a"] = "a";
4748
map["b"] = "b";
4849
b.Map = map;

src/NHibernate.Test/Legacy/MasterDetailTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ public void CollectionReplaceOnUpdate()
850850
ISession s = OpenSession();
851851
ITransaction t = s.BeginTransaction();
852852
Category c = new Category();
853-
IList list = new ArrayList();
853+
IList<Category> list = new List<Category>();
854854
c.Subcategories = list;
855855
list.Add(new Category());
856856
s.Save(c);
@@ -867,7 +867,7 @@ public void CollectionReplaceOnUpdate()
867867
s = OpenSession();
868868
t = s.BeginTransaction();
869869
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
870-
IList list2 = c.Subcategories;
870+
IList<Category> list2 = c.Subcategories;
871871
t.Commit();
872872
s.Close();
873873

@@ -895,7 +895,7 @@ public void CollectionReplace2()
895895
ISession s = OpenSession();
896896
ITransaction t = s.BeginTransaction();
897897
Category c = new Category();
898-
IList list = new ArrayList();
898+
IList<Category> list = new List<Category>();
899899
c.Subcategories = list;
900900
list.Add(new Category());
901901
Category c2 = new Category();
@@ -907,7 +907,7 @@ public void CollectionReplace2()
907907
s = OpenSession();
908908
t = s.BeginTransaction();
909909
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
910-
IList list2 = c.Subcategories;
910+
IList<Category> list2 = c.Subcategories;
911911
t.Commit();
912912
s.Close();
913913

@@ -934,7 +934,7 @@ public void CollectionReplace()
934934
ISession s = OpenSession();
935935
ITransaction t = s.BeginTransaction();
936936
Category c = new Category();
937-
IList list = new ArrayList();
937+
IList<Category> list = new List<Category>();
938938
c.Subcategories = list;
939939
list.Add(new Category());
940940
s.Save(c);
@@ -951,7 +951,7 @@ public void CollectionReplace()
951951
s = OpenSession();
952952
t = s.BeginTransaction();
953953
c = (Category) s.Load(typeof(Category), c.Id, LockMode.Upgrade);
954-
IList list2 = c.Subcategories;
954+
IList<Category> list2 = c.Subcategories;
955955
t.Commit();
956956
s.Close();
957957

@@ -997,7 +997,7 @@ public void Categories()
997997
c = (Category) s.Load(typeof(Category), c.Id);
998998
Assert.IsNotNull(c.Subcategories[0]);
999999
Assert.IsNotNull(c.Subcategories[1]);
1000-
IList list = ((Category) c.Subcategories[1]).Subcategories;
1000+
IList<Category> list = ((Category) c.Subcategories[1]).Subcategories;
10011001
Assert.IsNull(list[0]);
10021002
Assert.IsNotNull(list[1]);
10031003

@@ -1019,7 +1019,7 @@ public void CollectionRefresh()
10191019
{
10201020
ISession s = OpenSession();
10211021
Category c = new Category();
1022-
IList list = new ArrayList();
1022+
IList<Category> list = new List<Category>();
10231023
c.Subcategories = list;
10241024
list.Add(new Category());
10251025
c.Name = "root";
@@ -1062,7 +1062,7 @@ public void CachedCollectionRefresh()
10621062
{
10631063
ISession s = OpenSession();
10641064
Category c = new Category();
1065-
IList list = new ArrayList();
1065+
IList<Category> list = new List<Category>();
10661066
c.Subcategories = list;
10671067
list.Add(new Category());
10681068
c.Name = "root";

src/NHibernate.Test/NHSpecificTest/NH704/Cat.cs

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

44
namespace NHibernate.Test.NHSpecificTest.NH704
55
{
66
public class Cat
77
{
88
private int id;
9-
private IList children = new ArrayList();
9+
private IList<Cat> children = new List<Cat>();
1010
//Note: I initialized the collection here, if removed, Lock will work.
1111

1212
public int Id
@@ -15,7 +15,7 @@ public int Id
1515
set { id = value; }
1616
}
1717

18-
public IList Children
18+
public IList<Cat> Children
1919
{
2020
get { return children; }
2121
set { children = value; }

src/NHibernate.Test/NHSpecificTest/NH739/Cat.cs

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

33
namespace NHibernate.Test.NHSpecificTest.NH739
44
{
55
public class Cat
66
{
77
private int id;
8-
private IList children = new ArrayList();
8+
private IList<Cat> children = new List<Cat>();
99
private Cat mother;
1010

1111
public int Id
@@ -20,7 +20,7 @@ public Cat Mother
2020
set { mother = value; }
2121
}
2222

23-
public IList Children
23+
public IList<Cat> Children
2424
{
2525
get { return children; }
2626
set { children = value; }

0 commit comments

Comments
 (0)