Skip to content

Commit 2b36766

Browse files
committed
Merge branch 'master' into nh3565
2 parents 59a532b + 2e24925 commit 2b36766

File tree

70 files changed

+1763
-170
lines changed

Some content is hidden

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

70 files changed

+1763
-170
lines changed

.deepsource.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ version = 1
22

33
test_patterns = ["src/NHibernate.Test/**"]
44

5+
exclude_patterns = [
6+
"src/NHibernate/Async/**/*.cs",
7+
"src/NHibernate.DomainModel/Async/**/*.cs",
8+
"src/NHibernate.Test/Async/**/*.cs"
9+
]
10+
511
[[analyzers]]
612
name = "csharp"
713
enabled = true
14+
15+
[[transformers]]
16+
name = "dotnet-format"
17+
enabled = true

.github/renovate.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"pruneStaleBranches": false,
88
"automerge": true,
99
"platformAutomerge": true,
10+
"rebaseWhen": "never",
1011
"labels": [
1112
"dependencies",
1213
"p: Lowest",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Generate Async code
2+
3+
on:
4+
pull_request_target:
5+
paths:
6+
- '**.cs'
7+
8+
permissions: {}
9+
10+
jobs:
11+
generate-async:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
ref: ${{ github.event.pull_request.head.ref }}
18+
repository: ${{ github.event.pull_request.head.repo.full_name }}
19+
token: ${{ secrets.NHIBERNATE_BOT_TOKEN }}
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v2
23+
with:
24+
dotnet-version: 6.0.x
25+
26+
- name: Generate Async code
27+
run: |
28+
pushd src
29+
dotnet tool restore
30+
dotnet restore ./NHibernate.sln
31+
dotnet async-generator
32+
popd
33+
34+
- name: Push changes
35+
run: |
36+
git config user.name github-actions[bot]
37+
git config user.email github-actions[bot]@users.noreply.github.com
38+
if [[ -z "$(git status --porcelain)" ]]; then
39+
echo "No changes to commit"
40+
exit 0
41+
fi
42+
git add -A
43+
git commit -am "Generate async files"
44+
git push

.github/workflows/NetCoreTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
run: |
5353
docker run -d -p 1521:1521 -e APP_USER=nhibernate -e APP_USER_PASSWORD=nhibernate -e ORACLE_PASSWORD=nhibernate gvenzl/oracle-xe:18-slim
5454
55-
- uses: actions/checkout@v2
55+
- uses: actions/checkout@v3
5656
- name: Setup .NET
57-
uses: actions/setup-dotnet@v1
57+
uses: actions/setup-dotnet@v2
5858
with:
5959
dotnet-version: 6.0.x
6060

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ TestResult.xml
1919
.vs/
2020
/build-common/NHibernate.dev.props
2121
/doc/reference/master.xml
22+
/doc/bin/
23+
/doc/obj/
24+
/Tools/bin/
25+
/Tools/obj/

Tools/actual_msbuild.cmd

Lines changed: 0 additions & 11 deletions
This file was deleted.

Tools/packages.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="vswhere" Version="2.1.4" />
1514
<PackageReference Include="NUnit.Console" Version="3.10.0" />
1615
</ItemGroup>
1716

build-common/NHibernate.props

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
<TreatSpecificWarningsAsErrors />
3333

3434
<DisableImplicitPackageTargetFallback>True</DisableImplicitPackageTargetFallback>
35-
</PropertyGroup>
36-
<PropertyGroup Condition="'$(IsPackable)' == 'True'">
35+
3736
<PackageProjectUrl>https://nhibernate.info</PackageProjectUrl>
3837
<PackageIconUrl>https://raw.githubusercontent.com/nhibernate/nhibernate-core/master/logo/NHibernate-NuGet.png</PackageIconUrl>
3938
<PackageIcon>NHibernate-NuGet.png</PackageIcon>
@@ -46,6 +45,6 @@
4645
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
4746
</PropertyGroup>
4847
<ItemGroup>
49-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
48+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
5049
</ItemGroup>
5150
</Project>

doc/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
2+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
23
<PropertyGroup>
34
<!-- The configuration and platform will be used to determine which
45
assemblies to include from solution and project documentation
@@ -7,26 +8,27 @@
78
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
89
<SchemaVersion>2.0</SchemaVersion>
910
<ProjectGuid>{91f431cd-23fb-4ed4-a690-0344073c65f0}</ProjectGuid>
10-
<SHFBSchemaVersion>1.8.0.0</SHFBSchemaVersion>
11+
<SHFBSchemaVersion>2017.9.26.0</SHFBSchemaVersion>
1112
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
1213
Studio adds them anyway -->
1314
<AssemblyName>Documentation</AssemblyName>
1415
<RootNamespace>Documentation</RootNamespace>
1516
<Name>Documentation</Name>
1617
<!-- SHFB properties -->
17-
<OutputPath>${doc.out.dir}</OutputPath>
18+
<FrameworkVersion>.NET Framework 4.6.1</FrameworkVersion>
19+
<OutputPath></OutputPath>
1820
<HtmlHelpName>NHibernateAPI</HtmlHelpName>
19-
<HelpFileFormat>HtmlHelp1x</HelpFileFormat>
21+
<HelpFileFormat>HtmlHelp1</HelpFileFormat>
2022
<CopyrightText>NHibernate</CopyrightText>
2123
<CopyrightHref>https://nhibernate.info</CopyrightHref>
2224
<FeedbackEMailAddress>https://groups.google.com/group/nhibernate-development</FeedbackEMailAddress>
2325
<FeedbackEMailLinkText>nhibernate team</FeedbackEMailLinkText>
2426
<HelpTitle>NHibernate API Reference</HelpTitle>
2527
<IndentHtml>False</IndentHtml>
26-
<HelpFileVersion>${project.version}</HelpFileVersion>
28+
<HelpFileVersion>1.0.0.0</HelpFileVersion>
2729
<DocumentationSources>
28-
<DocumentationSource sourceFile="${root.dir}/src/NHibernate/bin/${build.config}/net461/NHibernate.dll" />
29-
<DocumentationSource sourceFile="${root.dir}/src/NHibernate/bin/${build.config}/net461/Nhibernate.xml" />
30+
<DocumentationSource sourceFile="../src/NHibernate/bin/$(Configuration)/net461/NHibernate.dll" />
31+
<DocumentationSource sourceFile="../src/NHibernate/bin/$(Configuration)/net461/Nhibernate.xml" />
3032
</DocumentationSources>
3133
</PropertyGroup>
3234
<!-- There are no properties for these two groups but they need to appear in
@@ -35,6 +37,10 @@
3537
</PropertyGroup>
3638
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3739
</PropertyGroup>
40+
<ItemGroup>
41+
<PackageReference Include="EWSoftware.SHFB.NETFramework" Version="4.8.0.2" />
42+
</ItemGroup>
43+
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="'$(MSBuildRestoreSessionId)' != ''" />
3844
<!-- Import the SHFB build targets -->
39-
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
45+
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" Condition="'$(MSBuildRestoreSessionId)' == ''" />
4046
</Project>

doc/documentation.build

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,7 @@
4242
</zip>
4343
</target>
4444

45-
<target name="apidocbuilder-project" depends="init">
46-
<copy file="NHibernate.shfbproj.template" tofile="NHibernate.shfbproj" overwrite="true">
47-
<filterchain>
48-
<expandproperties />
49-
</filterchain>
50-
</copy>
51-
</target>
52-
53-
<target name="api" depends="init apidocbuilder-project" description="Generates the API documentation (in MSDN style if available)">
45+
<target name="api" depends="init" description="Generates the API documentation (in MSDN style if available)">
5446
<uptodate property="api.uptodate">
5547
<sourcefiles>
5648
<include name="${root.dir}/src/NHibernate/bin/${build.config}/net461/*.dll" />
@@ -65,8 +57,12 @@
6557
<echo if="${api.uptodate}">API documentation is up to date, skipping generation step.</echo>
6658

6759
<if test="${not api.uptodate}">
68-
<exec program="${path::combine(tools.dir, 'actual_msbuild.cmd')}">
69-
<arg line="NHibernate.shfbproj" />
60+
<exec program="dotnet">
61+
<arg value="build" />
62+
<arg value="/p:HelpFileVersion=&quot;${project.version}&quot;" />
63+
<arg value="/p:OutputPath=&quot;${doc.out.dir}&quot;" />
64+
<arg value="/p:Configuration=&quot;${build.config}&quot;" />
65+
<arg value="NHibernate.shfbproj" />
7066
</exec>
7167
</if>
7268
</target>

doc/reference/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ the documentation. You don't need to download and install Saxon, its jars are
2222
present in the repository.
2323

2424
You need HTML Help Workshop to build the CHM help file, and Sandcastle Help File
25-
Builder (SHFB - https://github.com/EWSoftware/SHFB) to build the HtmlHelp2 help
26-
file.
25+
Builder v2021.11.7.0 or later (SHFB - https://github.com/EWSoftware/SHFB) to
26+
build the HtmlHelp2 help file.
2727

2828
================================================================================
2929
DocBook Quick Start

src/NHibernate.Test/Async/CacheTest/BatchableCacheFixture.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using NHibernate.Cache;
1616
using NHibernate.Cfg;
1717
using NHibernate.Linq;
18+
using NHibernate.Loader;
1819
using NHibernate.Multi;
1920
using NHibernate.Test.CacheTest.Caches;
2021
using NUnit.Framework;
@@ -24,9 +25,17 @@ namespace NHibernate.Test.CacheTest
2425
{
2526
using System.Threading.Tasks;
2627
using System.Threading;
27-
[TestFixture]
28+
[TestFixture(BatchFetchStyle.Dynamic)]
29+
[TestFixture(BatchFetchStyle.Legacy)]
2830
public class BatchableCacheFixtureAsync : TestCase
2931
{
32+
private readonly BatchFetchStyle _fetchStyle;
33+
34+
public BatchableCacheFixtureAsync(BatchFetchStyle fetchStyle)
35+
{
36+
_fetchStyle = fetchStyle;
37+
}
38+
3039
protected override string[] Mappings => new[]
3140
{
3241
"CacheTest.ReadOnly.hbm.xml",
@@ -43,6 +52,7 @@ protected override void Configure(Configuration configuration)
4352
configuration.SetProperty(Environment.UseQueryCache, "true");
4453
configuration.SetProperty(Environment.GenerateStatistics, "true");
4554
configuration.SetProperty(Environment.CacheProvider, typeof(BatchableCacheProvider).AssemblyQualifiedName);
55+
configuration.SetProperty(Environment.BatchFetchStyle, _fetchStyle.ToString());
4656
}
4757

4858
protected override void OnSetUp()

src/NHibernate.Test/Async/CacheTest/BatchableCacheSubclassFixture.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@
1515
using NHibernate.Cache;
1616
using NHibernate.Cfg;
1717
using NHibernate.DomainModel;
18+
using NHibernate.Loader;
1819
using NHibernate.Test.CacheTest.Caches;
1920
using NUnit.Framework;
2021

2122
namespace NHibernate.Test.CacheTest
2223
{
2324
using System.Threading.Tasks;
24-
[TestFixture]
25+
[TestFixture(BatchFetchStyle.Dynamic)]
26+
[TestFixture(BatchFetchStyle.Legacy)]
2527
public class BatchableCacheSubclassFixtureAsync : TestCase
2628
{
29+
private readonly BatchFetchStyle _fetchStyle;
30+
31+
public BatchableCacheSubclassFixtureAsync(BatchFetchStyle fetchStyle)
32+
{
33+
_fetchStyle = fetchStyle;
34+
}
35+
2736
protected override string[] Mappings
2837
{
2938
get
@@ -56,6 +65,7 @@ protected override void Configure(Configuration configuration)
5665
configuration.SetProperty(Cfg.Environment.UseSecondLevelCache, "true");
5766
configuration.SetProperty(Cfg.Environment.UseQueryCache, "true");
5867
configuration.SetProperty(Cfg.Environment.CacheProvider, typeof(BatchableCacheProvider).AssemblyQualifiedName);
68+
configuration.SetProperty(Cfg.Environment.BatchFetchStyle, _fetchStyle.ToString());
5969
}
6070

6171
protected override void OnSetUp()

src/NHibernate.Test/Async/Linq/ByMethod/JoinTests.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ public async Task LeftJoinExtensionMethodWithMultipleKeyPropertiesAsync()
111111
}
112112
}
113113

114+
[Test(Description = "GH-3104")]
115+
public async Task LeftJoinExtensionMethodWithInnerJoinAfterAsync()
116+
{
117+
var animals = await (db.Animals
118+
.LeftJoin(db.Mammals, o => o.Id, i => i.Id, (o, i) => new { animal = o, mammalLeft1 = i })
119+
.LeftJoin(db.Mammals, x => x.mammalLeft1.Id, y => y.Id, (o, i) => new { o.animal, o.mammalLeft1, mammalLeft2 = i })
120+
.Join(db.Mammals, o => o.mammalLeft2.Id, y => y.Id, (o, i) => new { o.animal, o.mammalLeft1, o.mammalLeft2, mammalInner = i })
121+
.Where(x => x.mammalLeft1.SerialNumber.StartsWith("9"))
122+
.Where(x => x.mammalLeft2.SerialNumber.StartsWith("9"))
123+
.Where(x => x.animal.SerialNumber.StartsWith("9"))
124+
.Where(x => x.mammalInner.SerialNumber.StartsWith("9"))
125+
.Select(x => new { SerialNumber = x.animal.SerialNumber })
126+
.ToListAsync());
127+
128+
Assert.That(animals.Count, Is.EqualTo(1));
129+
}
130+
114131
[Test]
115132
public async Task LeftJoinExtensionMethodWithOuterReferenceInWhereClauseOnlyAsync()
116133
{
@@ -299,6 +316,19 @@ from o2 in db.Animals.Where(x => x.BodyWeight > 50)
299316
select new {o, o2}).Take(1).ToListAsync());
300317
}
301318

319+
[Test]
320+
public async Task CanInnerJoinOnEntityWithSubclassesAsync()
321+
{
322+
//inner joined animal is not used in output (no need to join subclasses)
323+
var resultsFromOuter1 = await (db.Animals.Join(db.Animals, o => o.Id, i => i.Id, (o, i) => o).Take(1).ToListAsync());
324+
325+
//inner joined mammal is not used in output (but subclass join is needed for mammal)
326+
var resultsFromOuter2 = await (db.Animals.Join(db.Mammals, o => o.Id, i => i.Id, (o, i) => o).Take(1).ToListAsync());
327+
328+
//inner joined animal is used in output (all subclass joins are required)
329+
var resultsFromInner1 = await (db.Animals.Join(db.Animals, o => o.Id, i => i.Id, (o, i) => i).Take(1).ToListAsync());
330+
}
331+
302332
[Test(Description = "GH-2580")]
303333
public async Task CanInnerJoinOnSubclassWithBaseTableReferenceInOnClauseAsync()
304334
{

src/NHibernate.Test/Async/NHSpecificTest/NH3142/ChildrenTest.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,31 @@
1111
using System;
1212
using System.Collections;
1313
using System.Collections.Generic;
14+
using NHibernate.Cfg;
1415
using NHibernate.Driver;
16+
using NHibernate.Loader;
1517
using NUnit.Framework;
1618

1719
namespace NHibernate.Test.NHSpecificTest.NH3142
1820
{
1921
using System.Threading.Tasks;
20-
[TestFixture]
22+
[TestFixture(BatchFetchStyle.Dynamic)]
23+
[TestFixture(BatchFetchStyle.Legacy)]
2124
public class ChildrenTestAsync : BugTestCase
2225
{
26+
private readonly BatchFetchStyle _fetchStyle;
27+
28+
public ChildrenTestAsync(BatchFetchStyle fetchStyle)
29+
{
30+
_fetchStyle = fetchStyle;
31+
}
32+
33+
protected override void Configure(Configuration configuration)
34+
{
35+
base.Configure(configuration);
36+
configuration.SetProperty(Cfg.Environment.BatchFetchStyle, _fetchStyle.ToString());
37+
}
38+
2339
protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory)
2440
{
2541
return !(factory.ConnectionProvider.Driver is OracleManagedDataClientDriver);

0 commit comments

Comments
 (0)