Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/GenerateAsyncCode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
dotnet-version: 10.0.x

- name: Generate Async code
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/NetCoreTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
dotnet-version: 10.0.x

- name: Checkout
uses: actions/checkout@v5
Expand Down
4 changes: 2 additions & 2 deletions ShowBuildMenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ testSetupMenu() {
}

testRun(){
dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f net8.0
dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f net8.0
dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f net10.0
dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f net10.0
mainMenu
}

Expand Down
2 changes: 1 addition & 1 deletion Tools/BuildTool/BuildTool.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ environment:
init:
# Required for having windows endlines in sources zip
- git config --global core.autocrlf true
- ps: |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that .NET 10 is going to be added to an image so we might not need when we switch to the new image.
appveyor/build-images#173

Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
& $env:temp\dotnet-install.ps1 -Channel 10.0 -Quality preview -InstallDir "$env:ProgramFiles\dotnet"

build: off
before_test:
- ps: |-
Expand Down
7 changes: 4 additions & 3 deletions build-common/NHibernate.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<VersionPatch Condition="'$(VersionPatch)' == ''">0</VersionPatch>
<!-- Clear VersionSuffix for making release and set it to dev for making development builds -->
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
<LangVersion Condition="'$(MSBuildProjectExtension)' != '.vbproj'">12.0</LangVersion>
<LangVersion Condition="'$(MSBuildProjectExtension)' != '.vbproj'">14.0</LangVersion>

<VersionPrefix Condition="'$(VersionPrefix)' == ''">$(NhVersion).$(VersionPatch)</VersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' != '' AND '$(BuildNumber)' != ''">$(VersionSuffix).$(BuildNumber)</VersionSuffix>
<AssemblyVersion>$(NhVersion).0.0</AssemblyVersion>
<FileVersion Condition="'$(VersionSuffix)' != '' AND '$(BuildNumber)' != ''">$(VersionPrefix).$(BuildNumber)</FileVersion>
<FileVersion Condition="'$(FileVersion)' == ''">$(VersionPrefix).0</FileVersion>

<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net48;net8.0</NhAppTargetFrameworks>
<NhLibTargetFrameworks Condition ="$(NhLibTargetFrameworks) == ''">net461;net48;netcoreapp2.0;netstandard2.0;netstandard2.1;net6.0;net8.0</NhLibTargetFrameworks>
<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net48;net10.0</NhAppTargetFrameworks>
<NhLibTargetFrameworks Condition ="$(NhLibTargetFrameworks) == ''">net461;net48;netcoreapp2.0;netstandard2.0;netstandard2.1;net6.0;net8.0;net10.0</NhLibTargetFrameworks>
<RuntimeFrameworkVersion Condition="'$(TargetFramework)' == 'netcoreapp2.0'">2.0.3</RuntimeFrameworkVersion>
<NhNetFx>false</NhNetFx>
<NhNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</NhNetFx>
Expand All @@ -25,6 +25,7 @@
<NoWarn>$(NoWarn);NU1903</NoWarn>
<NoWarn Condition="'$(TargetFramework)' == 'net6.0'">$(NoWarn);SYSLIB0011</NoWarn>
<NoWarn Condition="'$(TargetFramework)' == 'net8.0'">$(NoWarn);SYSLIB0011;SYSLIB0050;SYSLIB0051</NoWarn>
<NoWarn Condition="'$(TargetFramework)' == 'net10.0'">$(NoWarn);SYSLIB0011;SYSLIB0050;SYSLIB0051</NoWarn>

<Product>NHibernate</Product>
<Company>NHibernate.info</Company>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "10.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Task Test -depends Build {
'NHibernate.Test',
'NHibernate.Test.VisualBasic'
) | ForEach-Object {
$assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "net8.0", "$_.dll")
$assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "net10.0", "$_.dll")
Exec {
dotnet $assembly --labels=before --nocolor "--result=$_-TestResult.xml"
}
Expand Down
2 changes: 1 addition & 1 deletion src/AsyncGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
scanForMissingAsyncMembers:
- all: true
- filePath: NHibernate.Test/NHibernate.Test.csproj
targetFramework: net8.0
targetFramework: net10.0
concurrentRun: true
applyChanges: true
suppressDiagnosticFailures:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<OptionExplicit>On</OptionExplicit>
<OptionStrict>On</OptionStrict>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<OutputType>Exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<None Remove="**\*.hbm.xml" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net10.0'">
<Compile Remove="**\Issues\NH3302\**" />
</ItemGroup>
<ItemGroup>
Expand All @@ -25,11 +25,11 @@
<None Include="..\NHibernate.Test\App.config" Link="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="NUnitLite" Version="3.14.0" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.Test/NHSpecificTest/NH1304/Funny.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public virtual int Id

public virtual string Field
{
get { return field; }
set { field = value; }
get { return this.field; }
set { this.field = value; }
}

public virtual string FieldCamelcase
Expand Down
8 changes: 4 additions & 4 deletions src/NHibernate.Test/NHSpecificTest/NH1487/Fixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace NHibernate.Test.NHSpecificTest.NH1487
public class Entity
{
int field;
public int Id { get { return field; } set { field = value; } }
public int A { get { return field; } set { field = value; } }
public int B { get { return field; } set { field = value; } }
public int C { get { return field; } set { field = value; } }
public int Id { get { return this.field; } set { this.field = value; } }
public int A { get { return this.field; } set { this.field = value; } }
public int B { get { return this.field; } set { this.field = value; } }
public int C { get { return this.field; } set { this.field = value; } }
}

/// <summary>
Expand Down
16 changes: 7 additions & 9 deletions src/NHibernate.Test/NHibernate.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
<NoWarn>$(NoWarn);3001;3002;3003;3005;8981;SYSLIB0003;SYSLIB0012</NoWarn>
<ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NHibernate.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<OutputType>Exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
Expand Down Expand Up @@ -43,7 +41,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net10.0'">
<Compile Remove="**\CfgTest\DefaultNsAssmFixture.cs" />
<Compile Remove="**\CfgTest\HbmOrderingFixture.cs" />
<Compile Remove="**\DynamicProxyTests\PeVerifyFixture.cs" />
Expand All @@ -65,7 +63,7 @@
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="9.1.1" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="MySql.Data" Version="8.0.30" />
Expand All @@ -86,16 +84,16 @@
<PackageReference Include="Microsoft.SqlServer.Compact" Version="4.0.8876.1" />
<PackageReference Include="Oracle.ManagedDataAccess" Version="21.14.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
<ItemGroup Condition="'$(TargetFramework)'=='net10.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="10.0.0" />
<PackageReference Include="System.CodeDom" Version="4.7.0" />
<PackageReference Include="System.Data.Odbc" Version="4.7.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Data.OracleClient" Version="1.0.8">
<ExcludeAssets>compile</ExcludeAssets>
</PackageReference>
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="10.0.0" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.140" />
<PackageReference Include="System.Data.Odbc" Version="4.7.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="NUnitLite" Version="3.14.0" />
</ItemGroup>
<ItemGroup Condition=" '$(NuGetPackageRoot)' != '' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<IsTestProject>true</IsTestProject>
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<OutputType>Exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
Expand All @@ -18,7 +18,7 @@
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="NUnitLite" Version="3.14.0" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Dialect/MsSql2000Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public LockHintAppender(MsSql2000Dialect dialect, IDictionary<string, LockMode>
// Match < alias >, < alias,>, or < alias$>, the intent is to capture alias names
// in various kinds of "FROM table1 alias1, table2 alias2".
_matchRegex = new Regex(" (" + aliasesPattern + ")([, ]|$)");
_unionSubclassRegex = new Regex(@"from\s+\(((?:.|\r|\n)*)\)(?:\s+as)?\s+(?<alias>" + aliasesPattern + ")", RegexOptions.IgnoreCase | RegexOptions.Multiline);
_unionSubclassRegex = new Regex(@"from\s+\(([\s\S]+)\)(?:\s+as)?\s+(?<alias>" + aliasesPattern + ")", RegexOptions.IgnoreCase | RegexOptions.Multiline);
}

public SqlString AppendLockHint(SqlString sql)
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate/Linq/Functions/QueryableGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ public CollectionContainsGenerator()
{
SupportedMethods = new[]
{
ReflectHelper.FastGetMethodDefinition(Queryable.Contains, default(IQueryable<object>), default(object)),
ReflectHelper.FastGetMethodDefinition(Enumerable.Contains, default(IEnumerable<object>), default(object))
ReflectionCache.QueryableMethods.ContainsDefinition,
ReflectionCache.EnumerableMethods.ContainsDefinition,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,41 @@ protected override Expression VisitConstant(ConstantExpression expression)
}
return base.VisitConstant(expression);
}

#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
protected override Expression VisitMethodCall(MethodCallExpression node)
{
if (IsMemoryExtensionContains(node.Method) &&
TryUnwrapImplicitSpanConversion(node.Arguments[0], out var array) &&
array.Type.IsArray)
{
var contains =
ReflectionCache.EnumerableMethods.ContainsDefinition.MakeGenericMethod(array.Type.GetElementType());

return base.VisitMethodCall(Expression.Call(contains, array, node.Arguments[1]));
}

return base.VisitMethodCall(node);
}

private static bool TryUnwrapImplicitSpanConversion(Expression span, out Expression array)
{
if (span is MethodCallExpression { Method: { Name: "op_Implicit" } method, Arguments: [var arg] } &&
(method.DeclaringType.IsSpan() || method.DeclaringType.IsReadOnlySpan()))
{
array = arg;
return true;
}

array = null;
return false;
}

private static bool IsMemoryExtensionContains(MethodInfo method)
{
return method.Name == "Contains" && method.DeclaringType == typeof(MemoryExtensions);
}
#endif
}

internal struct QueryVariable : IEquatable<QueryVariable>
Expand Down
4 changes: 4 additions & 0 deletions src/NHibernate/NHibernate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate/Properties/FieldAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public object Get(object target)
/// <value>The <see cref="System.Type"/> that the Field returns.</value>
public System.Type ReturnType
{
get { return field.FieldType; }
get { return this.field.FieldType; }
}

/// <summary>
Expand Down Expand Up @@ -322,7 +322,7 @@ public MethodInfo Method

public System.Type Type
{
get { return field.FieldType; }
get { return this.field.FieldType; }
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate/Proxy/DynamicProxy/ProxyImplementor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal class ProxyImplementor

public FieldBuilder InterceptorField
{
get { return field; }
get { return this.field; }
}

public void ImplementProxy(TypeBuilder typeBuilder)
Expand Down
6 changes: 6 additions & 0 deletions src/NHibernate/Util/ReflectionCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ internal static class EnumerableMethods

internal static readonly MethodInfo CastDefinition =
ReflectHelper.FastGetMethodDefinition(Enumerable.Cast<object>, default(IEnumerable));

internal static MethodInfo ContainsDefinition =
ReflectHelper.FastGetMethodDefinition(Enumerable.Contains, default(IEnumerable<object>), default(object));

internal static readonly MethodInfo GroupByWithElementSelectorDefinition =
ReflectHelper.FastGetMethodDefinition(Enumerable.GroupBy, default(IEnumerable<object>), default(Func<object, object>), default(Func<object, object>));
Expand Down Expand Up @@ -89,6 +92,9 @@ internal static class QueryableMethods
default(Expression<Func<object, int>>),
default(Expression<Func<object, IEnumerable<object>, object>>));

internal static MethodInfo ContainsDefinition =
ReflectHelper.FastGetMethodDefinition(Queryable.Contains, default(IQueryable<object>), default(object));

internal static readonly MethodInfo CountDefinition =
ReflectHelper.FastGetMethodDefinition(Queryable.Count, default(IQueryable<object>));
internal static readonly MethodInfo CountWithPredicateDefinition =
Expand Down
18 changes: 13 additions & 5 deletions src/NHibernate/Util/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ internal static bool IsIntegralNumberType(this System.Type type)
internal static bool IsRealNumberType(this System.Type type)
{
var code = System.Type.GetTypeCode(type);
if (code == TypeCode.Decimal || code == TypeCode.Single || code == TypeCode.Double)
{
return true;
}
return code == TypeCode.Decimal || code == TypeCode.Single || code == TypeCode.Double;
}


#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
internal static bool IsSpan(this System.Type type)
{
return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Span<>);
}

return false;
internal static bool IsReadOnlySpan(this System.Type type)
{
return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(ReadOnlySpan<>);
}
#endif
}
}
Loading