Skip to content

Commit 5901dd8

Browse files
authored
Merge branch 'master' into AsyncUpgrade
2 parents a7e13d0 + 3dcb91b commit 5901dd8

File tree

172 files changed

+5345
-776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+5345
-776
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ indent_size = 2
3030
[*.cshtml]
3131
indent_style = space
3232
indent_size = 4
33+
34+
[*.g]
35+
indent_style = tab

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ TestResult.xml
1616
.DS_Store
1717

1818
.idea/
19-
.vs/
19+
.vs/
20+
/build-common/NHibernate.dev.props

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 5.2.1.{build}
1+
version: 5.2.3.{build}
22
image: Visual Studio 2017
33
environment:
44
matrix:

build-common/NHibernate.props

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<Project>
22
<Import Project="DotNetSdkMono.props" />
3+
<Import Condition="Exists('NHibernate.dev.props')" Project="NHibernate.dev.props"/>
4+
35
<PropertyGroup>
46
<VersionMajor Condition="'$(VersionMajor)' == ''">5</VersionMajor>
57
<VersionMinor Condition="'$(VersionMinor)' == ''">2</VersionMinor>
6-
<VersionPatch Condition="'$(VersionPatch)' == ''">1</VersionPatch>
8+
<VersionPatch Condition="'$(VersionPatch)' == ''">3</VersionPatch>
79
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
810

911
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
1012
<AssemblyVersion>$(VersionMajor).$(VersionMinor).0.0</AssemblyVersion>
1113
<FileVersion>$(VersionPrefix).0</FileVersion>
1214

13-
<NhAppTargetFrameworks>net461;netcoreapp2.0</NhAppTargetFrameworks>
14-
<NhLibTargetFrameworks>net461;netcoreapp2.0;netstandard2.0</NhLibTargetFrameworks>
15+
<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net461;netcoreapp2.0</NhAppTargetFrameworks>
16+
<NhLibTargetFrameworks Condition ="$(NhLibTargetFrameworks) == ''">net461;netcoreapp2.0;netstandard2.0</NhLibTargetFrameworks>
1517

1618
<Product>NHibernate</Product>
1719
<Company>NHibernate.info</Company>

build-common/common.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
<!-- This is used only for build folder -->
1515
<!-- TODO: Either remove or refactor to use NHibernate.props -->
16-
<property name="project.version" value="5.2.1" overwrite="false" />
17-
<property name="project.version.numeric" value="5.2.1" overwrite="false" />
16+
<property name="project.version" value="5.2.3" overwrite="false" />
17+
<property name="project.version.numeric" value="5.2.3" overwrite="false" />
1818

1919
<!-- properties used to connect to database for testing -->
2020
<include buildfile="nhibernate-properties.xml" />

doc/reference/modules/manipulating_data.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,7 @@ firstSession.Save(potentialMate);
529529
cat.Mate = potentialMate;
530530
531531
// later, in a new session
532-
secondSession.Update(cat); // update cat
533-
secondSession.Update(mate); // update mate]]></programlisting>
532+
secondSession.Update(cat); // update cat]]></programlisting>
534533

535534
<para>
536535
If the <literal>Cat</literal> with identifier <literal>catId</literal> had already

releasenotes.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
Build 5.2.3
2+
=============================
3+
4+
Release notes - NHibernate - Version 5.2.3
5+
6+
1 issue was resolved in this release.
7+
8+
** Bug
9+
10+
* #1964 Unable to serialize session because SerializationFieldInfo is not marked as serializable
11+
12+
Build 5.2.2
13+
=============================
14+
15+
Release notes - NHibernate - Version 5.2.2
16+
17+
3 issues were resolved in this release.
18+
19+
** Bug
20+
21+
* #1953 Query space invalidation doesn't work for bulk actions
22+
* #1269 NH-3069 - Cannot use Session.Lock with Version column on abstract base class
23+
24+
** Task
25+
26+
* #1957 Release 5.2.2
127

228
Build 5.2.1
329
=============================
@@ -269,6 +295,15 @@ Release notes - NHibernate - Version 5.2.0
269295
As part of releasing 5.2.0, a misnamed setting in 5.0.0 release notes has been fixed:
270296
transaction.use_connection_on_system_events correct name is transaction.use_connection_on_system_prepare
271297

298+
Build 5.1.4
299+
=============================
300+
301+
Release notes - NHibernate - Version 5.1.4
302+
303+
** Bug
304+
305+
* #1959 Backport Query space invalidation doesn't work for bulk actions
306+
272307
Build 5.1.3
273308
=============================
274309

src/NHibernate.Test/Async/Criteria/Lambda/ProjectIntegrationFixture.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public async Task ProjectTransformToDtoAsync()
9999
var actual = await (s.QueryOver<Person>()
100100
.SelectList(list => list
101101
.SelectGroup(p => p.Name).WithAlias(() => summary.Name)
102+
//GH1985: DateTime.xxxx are not supported in SelectGroup
103+
.SelectGroup(p => p.BirthDate.Year).WithAlias(() => summary.BirthYear)
102104
.Select(Projections.RowCount()).WithAlias(() => summary.Count))
103105
.OrderByAlias(() => summary.Name).Asc
104106
.TransformUsing(Transformers.AliasToBean<PersonSummary>())
@@ -111,5 +113,26 @@ public async Task ProjectTransformToDtoAsync()
111113
Assert.That(actual[1].Count, Is.EqualTo(1));
112114
}
113115
}
116+
117+
[Test]
118+
public async Task ProjecionCountDistinctAsync()
119+
{
120+
if (!TestDialect.SupportsCountDistinct)
121+
Assert.Ignore("Dialect does not support count distinct");
122+
123+
using (var s = OpenSession())
124+
using (s.BeginTransaction())
125+
{
126+
var actual
127+
= (await (s.QueryOver<Person>()
128+
.SelectList(l =>
129+
l.SelectCountDistinct(p => p.BirthDate.Year)
130+
.SelectCountDistinct(p => p.Name))
131+
.ListAsync<object[]>())).FirstOrDefault();
132+
133+
Assert.That((int) actual[0], Is.EqualTo(1), "distinct count by birth year");
134+
Assert.That((int) actual[1], Is.EqualTo(2), "distinct count by name");
135+
}
136+
}
114137
}
115138
}

src/NHibernate.Test/Async/Criteria/Lambda/SubQueryIntegrationFixture.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,32 @@ public async Task SubQueryAsync()
166166
Assert.That(nameAndChildCount[1].ChildCount, Is.EqualTo(1));
167167
}
168168
}
169+
170+
//NH-3493 - Cannot use alias between more than 1 level of nested queries
171+
[Test]
172+
public async Task ThreeLevelSubqueryAsync()
173+
{
174+
if (!Dialect.SupportsScalarSubSelects)
175+
Assert.Ignore("Dialect does not support scalar sub-select");
176+
177+
Person p = null;
178+
var detachedCriteria2 = DetachedCriteria.For<Person>("vf_inner_2")
179+
.SetProjection(Projections.Id())
180+
.Add(Restrictions.Eq($@"mk.{nameof(p.Age)}", 20))
181+
.Add(Restrictions.EqProperty("vf_inner_2.Id", "vf_inner.Id"));
182+
183+
var detachedCriteria1 = DetachedCriteria.For<Person>("vf_inner")
184+
.SetProjection(Projections.Id())
185+
.Add(Subqueries.Exists(detachedCriteria2))
186+
.Add(Restrictions.EqProperty("vf_inner.Id", "vf.Id"));
187+
188+
using (var s = OpenSession())
189+
{
190+
await (s.CreateCriteria<Person>("vf")
191+
.CreateAlias($"vf.{nameof(p.Father)}", "mk")
192+
.AddOrder(Order.Asc(Projections.SubQuery(detachedCriteria1)))
193+
.ListAsync<Person>());
194+
}
195+
}
169196
}
170197
}

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

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using System.Linq;
1212
using NHibernate.Driver;
13+
using NHibernate.Linq;
1314
using NUnit.Framework;
1415

1516
namespace NHibernate.Test.Futures
@@ -18,9 +19,21 @@ namespace NHibernate.Test.Futures
1819
[TestFixture]
1920
public class FutureQueryFixtureAsync : FutureFixture
2021
{
22+
protected override void OnTearDown()
23+
{
24+
using (var session = OpenSession())
25+
using (var transaction = session.BeginTransaction())
26+
{
27+
session.Delete("from Person");
28+
transaction.Commit();
29+
}
30+
}
31+
2132
[Test]
2233
public async Task DefaultReadOnlyTestAsync()
2334
{
35+
CreatePersons();
36+
2437
//NH-3575
2538
using (var s = Sfi.OpenSession())
2639
{
@@ -125,23 +138,23 @@ public async Task CanExecuteMultipleQueryWithSameParameterNameAsync()
125138
using (var s = Sfi.OpenSession())
126139
{
127140
IgnoreThisTestIfMultipleQueriesArentSupportedByDriver();
128-
141+
129142
var meContainer = s.CreateQuery("from Person p where p.Id = :personId")
130143
.SetParameter("personId", 1)
131144
.FutureValue<Person>();
132-
145+
133146
var possiblefriends = s.CreateQuery("from Person p where p.Id != :personId")
134147
.SetParameter("personId", 2)
135148
.Future<Person>();
136149

137150
using (var logSpy = new SqlLogSpy())
138151
{
139152
var me = await (meContainer.GetValueAsync());
140-
153+
141154
foreach (var person in await (possiblefriends.GetEnumerableAsync()))
142155
{
143156
}
144-
157+
145158
var events = logSpy.Appender.GetEvents();
146159
Assert.AreEqual(1, events.Length);
147160
var wholeLog = logSpy.GetWholeLog();
@@ -172,5 +185,24 @@ public async Task FutureExecutedOnGetEnumerableAsync()
172185
Sfi.Statistics.IsStatisticsEnabled = false;
173186
}
174187
}
188+
189+
//NH-1953 - Future<> doesn't work on CreateFilter
190+
[Test]
191+
public async Task FutureOnFilterAsync()
192+
{
193+
CreatePersons();
194+
195+
using (var s = Sfi.OpenSession())
196+
{
197+
var person = await (s.Query<Person>().Where(n => n.Name == "ParentTwoChildren").FirstOrDefaultAsync());
198+
199+
var f1 = (await (s.CreateFilterAsync(person.Children, "where Age > 30"))).Future<Person>();
200+
var f2 = (await (s.CreateFilterAsync(person.Children, "where Age > 5"))).Future<Person>();
201+
202+
Assert.That(person.Children.Count, Is.EqualTo(2), "invalid test set up");
203+
Assert.That((await (f1.GetEnumerableAsync())).ToList().Count, Is.EqualTo(0), "Invalid filtered results");
204+
Assert.That((await (f2.GetEnumerableAsync())).ToList().Count, Is.EqualTo(1), "Invalid filtered results");
205+
}
206+
}
175207
}
176208
}

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

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,21 @@ namespace NHibernate.Test.Futures
2020
[TestFixture]
2121
public class LinqFutureFixtureAsync : FutureFixture
2222
{
23+
protected override void OnTearDown()
24+
{
25+
using (var session = OpenSession())
26+
using (var transaction = session.BeginTransaction())
27+
{
28+
session.Delete("from Person");
29+
transaction.Commit();
30+
}
31+
}
32+
2333
[Test]
2434
public async Task DefaultReadOnlyTestAsync()
2535
{
36+
CreatePersons();
37+
2638
//NH-3575
2739
using (var s = Sfi.OpenSession())
2840
{
@@ -56,13 +68,6 @@ public async Task CoalesceShouldWorkForFuturesAsync()
5668
var person = s.Query<Person>().Where(p => (p.Name ?? "e") == "e").ToFutureValue();
5769
Assert.AreEqual(personId, (await (person.GetValueAsync())).Id);
5870
}
59-
60-
using (ISession s = OpenSession())
61-
using (ITransaction tx = s.BeginTransaction())
62-
{
63-
await (s.DeleteAsync("from Person"));
64-
await (tx.CommitAsync());
65-
}
6671
}
6772

6873
[Test]
@@ -137,13 +142,6 @@ public async Task CanUseSkipAndFetchManyWithToFutureAsync()
137142
Assert.AreEqual(1, events.Length);
138143
}
139144
}
140-
141-
using (ISession s = OpenSession())
142-
using (ITransaction tx = s.BeginTransaction())
143-
{
144-
await (s.DeleteAsync("from Person"));
145-
await (tx.CommitAsync());
146-
}
147145
}
148146

149147
[Test]
@@ -270,13 +268,6 @@ public async Task CanUseFutureFetchQueryAsync()
270268
Assert.AreEqual(1, events.Length);
271269
}
272270
}
273-
274-
using (var s = OpenSession())
275-
using (var tx = s.BeginTransaction())
276-
{
277-
await (s.DeleteAsync("from Person"));
278-
await (tx.CommitAsync());
279-
}
280271
}
281272

282273
[Test]
@@ -360,13 +351,6 @@ public async Task CanCombineSingleFutureValueWithFetchManyAsync()
360351

361352
Assert.AreEqual(personId, (await (meContainer.GetValueAsync())).Id);
362353
}
363-
364-
using (var s = OpenSession())
365-
using (var tx = s.BeginTransaction())
366-
{
367-
await (s.DeleteAsync("from Person"));
368-
await (tx.CommitAsync());
369-
}
370354
}
371355

372356
[Test]
@@ -435,12 +419,6 @@ public async Task UsingManyParametersAndQueries_DoesNotCauseParameterNameCollisi
435419
Assert.That(result.Count,Is.EqualTo(1));
436420
}
437421
}
438-
using (var s = OpenSession())
439-
using (var tx = s.BeginTransaction())
440-
{
441-
await (s.DeleteAsync("from Person"));
442-
await (tx.CommitAsync());
443-
}
444422
}
445423

446424
[Test]
@@ -526,13 +504,6 @@ public async Task FutureCombineCachedAndNonCachedQueriesAsync()
526504

527505
Assert.That(Sfi.Statistics.PrepareStatementCount , Is.EqualTo(0), "Future queries must be retrieved from cache");
528506
}
529-
530-
using (var s = OpenSession())
531-
using (var tx = s.BeginTransaction())
532-
{
533-
await (s.DeleteAsync("from Person"));
534-
await (tx.CommitAsync());
535-
}
536507
}
537508

538509
[Test]
@@ -557,5 +528,22 @@ public async Task FutureAutoFlushAsync()
557528
Assert.That(count, Is.EqualTo(0), "Session wasn't auto flushed.");
558529
}
559530
}
531+
532+
[Test]
533+
public async Task FutureOnQueryableFilterAsync()
534+
{
535+
CreatePersons();
536+
537+
using (var s = Sfi.OpenSession())
538+
{
539+
var person = await (s.Query<Person>().Where(n => n.Name == "ParentTwoChildren").FirstOrDefaultAsync());
540+
var f1 = person.Children.AsQueryable().Where(p => p.Age > 30).ToFuture();
541+
var f2 = person.Children.AsQueryable().Where(p => p.Age > 5).ToFuture();
542+
543+
Assert.That(person.Children.Count, Is.EqualTo(2), "invalid test set up");
544+
Assert.That((await (f1.GetEnumerableAsync())).ToList().Count, Is.EqualTo(0), "Invalid filtered results");
545+
Assert.That((await (f2.GetEnumerableAsync())).ToList().Count, Is.EqualTo(1), "Invalid filtered results");
546+
}
547+
}
560548
}
561549
}

0 commit comments

Comments
 (0)