Skip to content

Commit 85a4cef

Browse files
authored
Merge branch 'master' into NH3864-Cacheable-Multicriteria
2 parents a1b6a56 + 06ad6ac commit 85a4cef

File tree

91 files changed

+2911
-374
lines changed

Some content is hidden

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

91 files changed

+2911
-374
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.6" targetFramework="net461" />
10+
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.7" 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.1.2.{build}
1+
version: 5.1.3.{build}
22
image: Visual Studio 2017
33
environment:
44
matrix:

build-common/NHibernate.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<VersionMajor Condition="'$(VersionMajor)' == ''">5</VersionMajor>
55
<VersionMinor Condition="'$(VersionMinor)' == ''">1</VersionMinor>
6-
<VersionPatch Condition="'$(VersionPatch)' == ''">2</VersionPatch>
6+
<VersionPatch Condition="'$(VersionPatch)' == ''">3</VersionPatch>
77
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
88

99
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>

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.1.2" overwrite="false" />
17-
<property name="project.version.numeric" value="5.1.2" overwrite="false" />
16+
<property name="project.version" value="5.1.3" overwrite="false" />
17+
<property name="project.version.numeric" value="5.1.3" overwrite="false" />
1818

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

doc/reference/modules/basic_mapping.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,8 @@
20812081

20822082
<para>
20832083
The <literal>&lt;dynamic-component&gt;</literal> element allows an <literal>IDictionary</literal>
2084-
to be mapped as a component, where the property names refer to keys of the dictionary.
2084+
or <literal>IDictionary&lt;string, object&gt;</literal>to be mapped as a component, where the property
2085+
names refer to keys of the dictionary.
20852086
</para>
20862087

20872088
</sect2>

doc/reference/modules/toolset_guide.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
<para>
6868
You <emphasis>must</emphasis> specify a SQL <literal>Dialect</literal> via the
69-
<literal>hibernate.dialect</literal> property when using this tool.
69+
<literal>dialect</literal> configuration property when using this tool.
7070
</para>
7171

7272
<sect2 id="toolsetguide-s1-2" revision="1">
@@ -262,23 +262,23 @@ new SchemaExport(cfg).Create(false, true);]]></programlisting>
262262
</thead>
263263
<tbody>
264264
<row>
265-
<entry><literal>hibernate.connection.driver_class</literal></entry>
265+
<entry><literal>connection.driver_class</literal></entry>
266266
<entry>jdbc driver class</entry>
267267
</row>
268268
<row>
269-
<entry><literal>hibernate.connection.url</literal></entry>
269+
<entry><literal>connection.url</literal></entry>
270270
<entry>jdbc url</entry>
271271
</row>
272272
<row>
273-
<entry><literal>hibernate.connection.username</literal></entry>
273+
<entry><literal>connection.username</literal></entry>
274274
<entry>database user</entry>
275275
</row>
276276
<row>
277-
<entry><literal>hibernate.connection.password</literal></entry>
277+
<entry><literal>connection.password</literal></entry>
278278
<entry>user password</entry>
279279
</row>
280280
<row>
281-
<entry><literal>hibernate.dialect</literal></entry>
281+
<entry><literal>dialect</literal></entry>
282282
<entry>dialect</entry>
283283
</row>
284284
</tbody>

releasenotes.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Build 5.1.3
2+
=============================
3+
4+
Release notes - NHibernate - Version 5.1.3
5+
6+
** Bug
7+
8+
* #1741 Fix DbType.Binary registration in DB2Dialect
9+
* #1732 Dictionary failure in Loader
10+
* #1730 Query cache always missed in session having altered the entities
11+
* #1711 Fix static proxy serialization
12+
13+
** Task
14+
15+
* #1716 Release 5.1.3
16+
17+
118
Build 5.1.2
219
=============================
320

src/AsyncGenerator.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@
170170
applyChanges: true
171171
analyzation:
172172
methodConversion:
173+
- conversion: Copy
174+
name: AfterTransactionCompletionProcess_EvictsFromCache
173175
- conversion: Copy
174176
hasAttributeName: OneTimeSetUpAttribute
175177
- conversion: Copy
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 System.Collections;
13+
using System.Collections.Concurrent;
14+
using System.Collections.Generic;
15+
using System.Linq;
16+
using NHibernate.Cache;
17+
using NHibernate.Cfg;
18+
using NSubstitute;
19+
using NUnit.Framework;
20+
using Environment = NHibernate.Cfg.Environment;
21+
22+
namespace NHibernate.Test.BulkManipulation
23+
{
24+
using System.Threading.Tasks;
25+
[TestFixture]
26+
public class NativeSQLBulkOperationsWithCacheAsync : TestCase
27+
{
28+
protected override string MappingsAssembly => "NHibernate.Test";
29+
30+
protected override IList Mappings => new[] { "BulkManipulation.Vehicle.hbm.xml" };
31+
32+
protected override void Configure(Configuration configuration)
33+
{
34+
cfg.SetProperty(Environment.UseQueryCache, "true");
35+
cfg.SetProperty(Environment.UseSecondLevelCache, "true");
36+
cfg.SetProperty(Environment.CacheProvider, typeof(SubstituteCacheProvider).AssemblyQualifiedName);
37+
}
38+
39+
[Test]
40+
public async Task SimpleNativeSQLInsert_DoesNotEvictEntireCacheWhenQuerySpacesAreAddedAsync()
41+
{
42+
List<string> clearCalls = new List<string>();
43+
(Sfi.Settings.CacheProvider as SubstituteCacheProvider).OnClear(x =>
44+
{
45+
clearCalls.Add(x);
46+
});
47+
using (var s = OpenSession())
48+
{
49+
string ssql = "UPDATE Vehicle SET Vin='123' WHERE Vin='123c'";
50+
51+
using (var t = s.BeginTransaction())
52+
{
53+
54+
await (s.CreateSQLQuery(ssql).ExecuteUpdateAsync());
55+
await (t.CommitAsync());
56+
57+
Assert.AreEqual(1, clearCalls.Count);
58+
}
59+
60+
clearCalls.Clear();
61+
62+
using (var t = s.BeginTransaction())
63+
{
64+
await (s.CreateSQLQuery(ssql).AddSynchronizedQuerySpace("Unknown").ExecuteUpdateAsync());
65+
await (t.CommitAsync());
66+
67+
Assert.AreEqual(0, clearCalls.Count);
68+
}
69+
}
70+
}
71+
}
72+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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 NHibernate.Cfg;
12+
using NUnit.Framework;
13+
14+
namespace NHibernate.Test.NHSpecificTest.GH1730
15+
{
16+
using System.Threading.Tasks;
17+
[TestFixture]
18+
public class FixtureAsync : BugTestCase
19+
{
20+
protected override void Configure(Configuration configuration)
21+
{
22+
cfg.SetProperty(Environment.GenerateStatistics, "true");
23+
}
24+
25+
protected override void OnTearDown()
26+
{
27+
using (var session = OpenSession())
28+
using (var transaction = session.BeginTransaction())
29+
{
30+
session.CreateQuery("delete from Entity").ExecuteUpdate();
31+
32+
transaction.Commit();
33+
}
34+
}
35+
36+
[Test]
37+
public async Task HitCacheInSameSessionAsync()
38+
{
39+
await (Sfi.EvictQueriesAsync());
40+
Sfi.Statistics.Clear();
41+
var entities = new System.Collections.Generic.List<Entity>();
42+
43+
using (var session = OpenSession())
44+
{
45+
using (var transaction = session.BeginTransaction())
46+
{
47+
for (int i = 0; i < 3; i++)
48+
{
49+
var e = new Entity { Name = "Name" + i };
50+
entities.Add(e);
51+
await (session.SaveAsync(e));
52+
}
53+
await (transaction.CommitAsync());
54+
}
55+
56+
var queryString = "from Entity";
57+
58+
using (var tx = session.BeginTransaction())
59+
{
60+
// this query will hit the database and create the cache
61+
await (session.CreateQuery(queryString).SetCacheable(true).ListAsync());
62+
await (tx.CommitAsync());
63+
}
64+
65+
using (var transaction = session.BeginTransaction())
66+
{
67+
//and this one SHOULD served by the cache
68+
await (session.CreateQuery(queryString).SetCacheable(true).ListAsync());
69+
await (transaction.CommitAsync());
70+
}
71+
72+
var qs = Sfi.Statistics.GetQueryStatistics(queryString);
73+
Assert.AreEqual(1, qs.CacheHitCount);
74+
Assert.AreEqual(1, qs.CachePutCount);
75+
}
76+
}
77+
}
78+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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 System.Collections.Generic;
13+
using NUnit.Framework;
14+
15+
16+
namespace NHibernate.Test.NHSpecificTest.NH1039Generic
17+
{
18+
using System.Threading.Tasks;
19+
[TestFixture]
20+
public class FixtureAsync : BugTestCase
21+
{
22+
public override string BugNumber
23+
{
24+
get { return "NH1039Generic"; }
25+
}
26+
27+
protected override void OnTearDown()
28+
{
29+
base.OnTearDown();
30+
using (ISession s = OpenSession())
31+
using (ITransaction tx = s.BeginTransaction())
32+
{
33+
s.Delete("from Person");
34+
tx.Commit();
35+
}
36+
}
37+
38+
[Test]
39+
public async Task testAsync()
40+
{
41+
using (ISession s = OpenSession())
42+
using (ITransaction tx = s.BeginTransaction())
43+
{
44+
Person person = new Person("1");
45+
person.Name = "John Doe";
46+
var set = new HashSet<object>();
47+
set.Add("555-1234");
48+
set.Add("555-4321");
49+
person.Properties.Add("Phones", set);
50+
51+
await (s.SaveAsync(person));
52+
await (tx.CommitAsync());
53+
}
54+
using (ISession s = OpenSession())
55+
using (ITransaction tx = s.BeginTransaction())
56+
{
57+
Person person = (Person)await (s.CreateCriteria(typeof(Person)).UniqueResultAsync());
58+
59+
Assert.AreEqual("1", person.ID);
60+
Assert.AreEqual("John Doe", person.Name);
61+
Assert.AreEqual(1, person.Properties.Count);
62+
Assert.That(person.Properties["Phones"], Is.InstanceOf<ISet<object>>());
63+
Assert.IsTrue(((ISet<object>) person.Properties["Phones"]).Contains("555-1234"));
64+
Assert.IsTrue(((ISet<object>) person.Properties["Phones"]).Contains("555-4321"));
65+
}
66+
}
67+
}
68+
}

src/NHibernate.Test/Async/NHSpecificTest/NH2204/Fixture.cs renamed to src/NHibernate.Test/Async/NHSpecificTest/NH1316/Fixture.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using NHibernate.Dialect;
1515

1616

17-
namespace NHibernate.Test.NHSpecificTest.NH2204
17+
namespace NHibernate.Test.NHSpecificTest.NH1316
1818
{
1919
using System.Threading.Tasks;
2020
[TestFixture]
@@ -66,7 +66,7 @@ protected override void OnTearDown()
6666

6767

6868
[Test]
69-
public async Task KnownFailure_Correct_Id_Returned_When_Using_TriggerAsync()
69+
public async Task Correct_Id_Returned_When_Using_TriggerAsync()
7070
{
7171
//We expected this test to fail - if the problem has been fixed, clean-up the test.
7272
var entity1 = new Parent {Name = "Parent1_0"}; // when saved this entity should have the id of 1
@@ -100,13 +100,10 @@ public async Task KnownFailure_Correct_Id_Returned_When_Using_TriggerAsync()
100100
await (s.SaveAsync(entity3));
101101
await (s.FlushAsync());
102102

103-
Warn.Unless(
103+
Assert.That(
104104
entity3.Id,
105105
Is.EqualTo(3),
106106
"oh uh - it would appear that lastval() is not our friend when a trigger updates other sequences.");
107-
108-
// now would be a good time to look at the data in the tables and see that they have the IDs as expected
109-
// which are not the same as those returned by nhibernate
110107
}
111108
}
112109
}

0 commit comments

Comments
 (0)