Skip to content

Commit c64050f

Browse files
committed
Get rid of SingletonEnumerable
1 parent 621bb3a commit c64050f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/NHibernate.Test/UtilityTest/SingletonEnumerableFixture.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
using System;
12
using System.Collections;
23
using NHibernate.Util;
34
using NUnit.Framework;
45

56
namespace NHibernate.Test.UtilityTest
67
{
8+
[Obsolete]
79
[TestFixture]
810
public class SingletonEnumerableFixture
911
{
@@ -46,4 +48,4 @@ public void ShouldWorkAsEnumerator()
4648
Assert.That(i, Is.EqualTo(1));
4749
}
4850
}
49-
}
51+
}

src/NHibernate/Mapping/RootClass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ public override IEnumerable<Property> PropertyClosureIterator
8989
/// </remarks>
9090
public override IEnumerable<Table> TableClosureIterator
9191
{
92-
get { return new SingletonEnumerable<Table>(Table); }
92+
get { return new[] {Table}; }
9393
}
9494

9595
public override IEnumerable<IKeyValue> KeyClosureIterator
9696
{
97-
get { return new SingletonEnumerable<IKeyValue>(Key); }
97+
get { return new[] {Key}; }
9898
}
9999

100100
/// <summary>

src/NHibernate/Util/SingletonEnumerable.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
using System;
12
using System.Collections;
23
using System.Collections.Generic;
34

45
namespace NHibernate.Util
56
{
7+
//Since 5.2
8+
[Obsolete("This class has no more usages and will be removed in a future version")]
69
public sealed class SingletonEnumerable<T> : IEnumerable<T>
710
{
811
private readonly T value;
@@ -78,4 +81,4 @@ object IEnumerator.Current
7881
#endregion
7982
}
8083
}
81-
}
84+
}

0 commit comments

Comments
 (0)