Skip to content

Commit 2875541

Browse files
Merge 5.0.5 into 5.1.x
2 parents 1fceefd + 1188ca6 commit 2875541

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

releasenotes.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ Release notes - NHibernate - Version 5.1.0
192192
As part of releasing 5.1.0, a missing 5.0.0 possible breaking change has been added about inequality semantic in LINQ
193193
queries. See 5.0.0 possible breaking changes.
194194

195+
Build 5.0.5
196+
=============================
197+
198+
Release notes - NHibernate - Version 5.0.5
199+
200+
** Bug
201+
* #1665 Have IFutureEnumerable.GetEnumerable executing immediatly the query
202+
195203
Build 5.0.4
196204
=============================
197205

src/NHibernate.Test/Async/Futures/FutureQueryFixture.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,25 @@ public async Task CanExecuteMultipleQueryWithSameParameterNameAsync()
152152
}
153153
}
154154
}
155+
156+
[Test]
157+
public async Task FutureExecutedOnGetEnumerableAsync()
158+
{
159+
Sfi.Statistics.IsStatisticsEnabled = true;
160+
try
161+
{
162+
using (var s = Sfi.OpenSession())
163+
{
164+
var persons = s.CreateQuery("from Person").Future<Person>();
165+
Sfi.Statistics.Clear();
166+
await (persons.GetEnumerableAsync());
167+
Assert.That(Sfi.Statistics.PrepareStatementCount, Is.EqualTo(1));
168+
}
169+
}
170+
finally
171+
{
172+
Sfi.Statistics.IsStatisticsEnabled = false;
173+
}
174+
}
155175
}
156176
}

src/NHibernate.Test/Futures/FutureQueryFixture.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,25 @@ public void CanExecuteMultipleQueryWithSameParameterName()
141141
}
142142
}
143143
}
144+
145+
[Test]
146+
public void FutureExecutedOnGetEnumerable()
147+
{
148+
Sfi.Statistics.IsStatisticsEnabled = true;
149+
try
150+
{
151+
using (var s = Sfi.OpenSession())
152+
{
153+
var persons = s.CreateQuery("from Person").Future<Person>();
154+
Sfi.Statistics.Clear();
155+
persons.GetEnumerable();
156+
Assert.That(Sfi.Statistics.PrepareStatementCount, Is.EqualTo(1));
157+
}
158+
}
159+
finally
160+
{
161+
Sfi.Statistics.IsStatisticsEnabled = false;
162+
}
163+
}
144164
}
145165
}

src/NHibernate/Impl/DelayedEnumerator.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ public DelayedEnumerator(GetResult result, GetResultAsync resultAsync)
2525

2626
public IEnumerable<T> GetEnumerable()
2727
{
28-
var value = _result();
29-
foreach (T item in value)
30-
{
31-
yield return item;
32-
}
28+
return _result();
3329
}
3430

3531
// Remove in 6.0

0 commit comments

Comments
 (0)