Skip to content

Commit 365b786

Browse files
Merge branch 'master' into CacheFetch
2 parents d682f53 + f5e2431 commit 365b786

File tree

87 files changed

+1736
-642
lines changed

Some content is hidden

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

87 files changed

+1736
-642
lines changed

Tools/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net461" />
88
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net461" />
99
<package id="NUnit.Extension.VSProjectLoader" version="3.6.0" targetFramework="net461" />
10-
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.9" targetFramework="net461" />
10+
<package id="CSharpAsyncGenerator.CommandLine" version="0.13.1" targetFramework="net461" />
1111
<package id="vswhere" version="2.1.4" targetFramework="net461" />
1212
<package id="gitreleasemanager" version="0.7.0" targetFramework="net461" />
1313
</packages>

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<PropertyGroup>
66
<VersionMajor Condition="'$(VersionMajor)' == ''">5</VersionMajor>
77
<VersionMinor Condition="'$(VersionMinor)' == ''">2</VersionMinor>
8-
<VersionPatch Condition="'$(VersionPatch)' == ''">1</VersionPatch>
8+
<VersionPatch Condition="'$(VersionPatch)' == ''">3</VersionPatch>
99
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
1010

1111
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
@@ -24,7 +24,7 @@
2424
<PackageProjectUrl>http://nhibernate.info</PackageProjectUrl>
2525
<PackageIconUrl>https://raw.githubusercontent.com/nhibernate/nhibernate-core/master/logo/NHibernate-NuGet.png</PackageIconUrl>
2626
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
27-
<PackageLicenseUrl>https://raw.githubusercontent.com/nhibernate/nhibernate-core/master/LICENSE.txt</PackageLicenseUrl>
27+
<PackageLicenseExpression>LGPL-2.1-only</PackageLicenseExpression>
2828
<PackageReleaseNotes>https://github.com/nhibernate/nhibernate-core/blob/$(VersionPrefix)/releasenotes.txt</PackageReleaseNotes>
2929
<RepositoryUrl>https://github.com/nhibernate/nhibernate-core.git</RepositoryUrl>
3030
<RepositoryType>git</RepositoryType>

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
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System;
12+
using NHibernate.Bytecode;
13+
using NUnit.Framework;
14+
15+
namespace NHibernate.Test.GhostProperty
16+
{
17+
using System.Threading.Tasks;
18+
// Since 5.3
19+
[Obsolete]
20+
[TestFixture]
21+
public class GhostPropertyDynamicProxyFixtureAsync : GhostPropertyFixtureAsync
22+
{
23+
private string _originalProxyFactoryFactory;
24+
25+
protected override void Configure(Cfg.Configuration configuration)
26+
{
27+
base.Configure(configuration);
28+
_originalProxyFactoryFactory = Cfg.Environment.BytecodeProvider.ProxyFactoryFactory.GetType().FullName;
29+
configuration.SetProperty(Cfg.Environment.ProxyFactoryFactoryClass, typeof(DefaultProxyFactoryFactory).FullName);
30+
}
31+
32+
protected override void DropSchema()
33+
{
34+
base.DropSchema();
35+
// Reset IProxyFactoryFactory back to default
36+
var injectableProxyFactory = (IInjectableProxyFactoryFactory) Cfg.Environment.BytecodeProvider;
37+
injectableProxyFactory.SetProxyFactoryFactory(_originalProxyFactoryFactory);
38+
}
39+
}
40+
}

src/NHibernate.Test/Async/GhostProperty/GhostPropertyFixture.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ protected override void OnSetUp()
4747
Id = 1
4848
};
4949
s.Persist(wireTransfer);
50+
var creditCard = new CreditCard
51+
{
52+
Id = 2
53+
};
54+
s.Persist(creditCard);
5055
s.Persist(new Order
5156
{
5257
Id = 1,
@@ -89,6 +94,71 @@ public async Task CanGetActualValueFromLazyManyToOneAsync()
8994
}
9095
}
9196

97+
[Test]
98+
public async Task CanGetInitializedLazyManyToOneAfterClosedSessionAsync()
99+
{
100+
Order order;
101+
Payment payment;
102+
103+
using (var s = OpenSession())
104+
{
105+
order = await (s.GetAsync<Order>(1));
106+
payment = order.Payment; // Initialize Payment
107+
}
108+
109+
Assert.That(order.Payment, Is.EqualTo(payment));
110+
Assert.That(order.Payment is WireTransfer, Is.True);
111+
}
112+
113+
[Test]
114+
public async Task InitializedLazyManyToOneBeforeParentShouldNotBeAProxyAsync()
115+
{
116+
Order order;
117+
Payment payment;
118+
119+
using (var s = OpenSession())
120+
{
121+
payment = await (s.LoadAsync<Payment>(1));
122+
await (NHibernateUtil.InitializeAsync(payment));
123+
order = await (s.GetAsync<Order>(1));
124+
// Here the Payment property should be unwrapped
125+
payment = order.Payment;
126+
}
127+
128+
Assert.That(order.Payment, Is.EqualTo(payment));
129+
Assert.That(order.Payment is WireTransfer, Is.True);
130+
}
131+
132+
[Test]
133+
public async Task SetUninitializedProxyShouldNotTriggerPropertyInitializationAsync()
134+
{
135+
using (var s = OpenSession())
136+
{
137+
var order = await (s.GetAsync<Order>(1));
138+
Assert.That(order.Payment is WireTransfer, Is.True); // Load property
139+
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.True);
140+
order.Payment = await (s.LoadAsync<Payment>(2));
141+
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.True);
142+
Assert.That(NHibernateUtil.IsInitialized(order.Payment), Is.False);
143+
Assert.That(order.Payment is WireTransfer, Is.False);
144+
}
145+
}
146+
147+
[Test]
148+
public async Task SetInitializedProxyShouldNotResetPropertyInitializationAsync()
149+
{
150+
using (var s = OpenSession())
151+
{
152+
var order = await (s.GetAsync<Order>(1));
153+
var payment = await (s.LoadAsync<Payment>(2));
154+
Assert.That(order.Payment is WireTransfer, Is.True); // Load property
155+
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.True);
156+
await (NHibernateUtil.InitializeAsync(payment));
157+
order.Payment = payment;
158+
Assert.That(NHibernateUtil.IsPropertyInitialized(order, "Payment"), Is.True);
159+
}
160+
}
161+
92162
[Test]
93163
public async Task WillNotLoadGhostPropertyByDefaultAsync()
94164
{
@@ -183,5 +253,18 @@ public async Task AcceptPropertySetWithTransientObjectAsync()
183253

184254
Assert.That(order.Payment, Is.EqualTo(newPayment));
185255
}
256+
257+
[Test]
258+
public async Task WillFetchJoinInSingleHqlQueryAsync()
259+
{
260+
Order order = null;
261+
262+
using (ISession s = OpenSession())
263+
{
264+
order = (await (s.CreateQuery("from Order o left join fetch o.Payment where o.Id = 1").ListAsync<Order>()))[0];
265+
}
266+
267+
Assert.DoesNotThrow(() => { var x = order.Payment; });
268+
}
186269
}
187270
}

src/NHibernate.Test/Async/LazyOneToOne/LazyOneToOneTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public async Task LazyAsync()
7878

7979
s = OpenSession();
8080
t = s.BeginTransaction();
81-
p = await (s.GetAsync<Person>("Gavin"));
82-
Assert.That(!NHibernateUtil.IsPropertyInitialized(p, "Employee"));
81+
p = await (s.GetAsync<Person>("Gavin")); // The default loader will fetch the employee
82+
Assert.That(NHibernateUtil.IsPropertyInitialized(p, "Employee"));
8383

8484
Assert.That(p.Employee.Person, Is.SameAs(p));
8585
Assert.That(NHibernateUtil.IsInitialized(p.Employee.Employments));
@@ -95,4 +95,4 @@ public async Task LazyAsync()
9595
s.Close();
9696
}
9797
}
98-
}
98+
}

0 commit comments

Comments
 (0)