Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
da54696
initial net10 update
ChrisJollyAU Jul 9, 2025
fc8873f
more test work
ChrisJollyAU Jul 15, 2025
57e7b30
rc1 work
ChrisJollyAU Oct 18, 2025
7063662
rc2 update
ChrisJollyAU Oct 19, 2025
e7bdd1d
Math.Truncate rounds towards 0. Use FIX instead of INT to match that …
ChrisJollyAU Jul 23, 2025
20897e3
Update to EF10 (#284)
ChrisJollyAU Jul 29, 2025
fc07b9b
update tests
ChrisJollyAU Oct 19, 2025
136c4fc
Update to EF10 RTM
ChrisJollyAU Nov 27, 2025
a6fa2c7
fix ef.jet.data.tests
ChrisJollyAU Nov 27, 2025
f0df23a
another fix
ChrisJollyAU Nov 27, 2025
98a39f1
some more fixes
ChrisJollyAU Nov 27, 2025
009fe06
another fix attempt
ChrisJollyAU Nov 27, 2025
ff81424
more fixes
ChrisJollyAU Nov 28, 2025
937d188
more fixes
ChrisJollyAU Nov 28, 2025
95d6f3a
Fix Skip 0 Take 0
ChrisJollyAU Nov 28, 2025
02ece83
fix tests
ChrisJollyAU Nov 28, 2025
f0d56b2
try to split functionaltests
ChrisJollyAU Nov 29, 2025
bb09b12
more fixes
ChrisJollyAU Nov 29, 2025
8c86e4a
typo
ChrisJollyAU Nov 29, 2025
17a61ee
Revert
ChrisJollyAU Nov 29, 2025
968b7db
try to rerun for system resource exceeded
ChrisJollyAU Nov 29, 2025
22aede2
fixes
ChrisJollyAU Nov 29, 2025
c2d0a01
fixes
ChrisJollyAU Nov 29, 2025
7a9d220
fixes
ChrisJollyAU Nov 29, 2025
0204003
Add OdbcGuidTypeMapping because odbc needs gui wrapped in quotes
ChrisJollyAU Nov 29, 2025
fadc88b
fixes
ChrisJollyAU Nov 29, 2025
9a09f07
fix
ChrisJollyAU Nov 29, 2025
00b49cd
fixes
ChrisJollyAU Dec 6, 2025
9dc126c
fix
ChrisJollyAU Dec 6, 2025
3263760
Merge branch 'master' into pr/287
ChrisJollyAU Dec 6, 2025
ed5e9a2
files addded due to merge shouldnt be here
ChrisJollyAU Dec 6, 2025
ccd6757
[GitHub Actions] Update green tests.
invalid-email-address Dec 6, 2025
e4f6b4f
skip a crashing test
ChrisJollyAU Dec 7, 2025
d4b9782
fix
ChrisJollyAU Dec 7, 2025
d59e9e9
[GitHub Actions] Update green tests.
invalid-email-address Dec 7, 2025
dd141f8
manually update green tests for odbc
ChrisJollyAU Dec 7, 2025
1189ae4
Merge branch 'net10' of https://github.com/ChrisJollyAU/EntityFramewo…
ChrisJollyAU Dec 7, 2025
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
16 changes: 8 additions & 8 deletions Dependencies.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<DotNetVersion>[10.0.0-preview.6.25358.103,10.0.999]</DotNetVersion>
<EFCoreVersion>[10.0.0-preview.6.25358.103,10.0.999]</EFCoreVersion>
<MSLibVersion>[10.0.0-preview.6.25358.103,10.0.999]</MSLibVersion>
<DotNetVersion>[10.0.0,10.0.999]</DotNetVersion>
<EFCoreVersion>[10.0.0,10.0.999]</EFCoreVersion>
<MSLibVersion>[10.0.0,10.0.999]</MSLibVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,16 +28,16 @@
<PackageReference Update="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="$(MSLibVersion)" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Update="MSTest.TestAdapter" Version="3.9.3" />
<PackageReference Update="MSTest.TestFramework" Version="3.9.3" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Update="MSTest.TestAdapter" Version="4.0.2" />
<PackageReference Update="MSTest.TestFramework" Version="4.0.2" />
<PackageReference Update="coverlet.collector" Version="6.0.4" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.4" />

<!-- EFCore.Jet.FunctionalTests -->
<PackageReference Update="xunit.core" Version="2.9.3"/>
<PackageReference Update="xunit.assert" Version="2.9.3" />
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.5" />
<PackageReference Update="xunit.runner.console" Version="2.9.3" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MSLibVersion)" />
<PackageReference Update="NetTopologySuite" Version="2.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
correctly.
-->
<VersionPrefix>10.0.0</VersionPrefix>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>

<!--
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": "10.0.100-preview.6.25358.103",
"version": "10.0.100",
"allowPrerelease": true,
"rollForward": "latestFeature"
}
Expand Down
9 changes: 8 additions & 1 deletion src/EFCore.Jet.Odbc/EFCore.Jet.Odbc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<PackageTags>$(PackageTags);ODBC;System.Data.Odbc</PackageTags>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Data.Odbc" />
<PackageReference Include="System.Data.Odbc" Version="4.5.2" />
</ItemGroup>

<ItemGroup Condition="'$(LocalEFCoreRepository)' != ''">
Expand All @@ -30,4 +31,10 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.EntityFrameworkCore.Diagnostics" />
<Using Include="System.Diagnostics" />
<Using Include="System.Diagnostics.CodeAnalysis" />
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions src/EFCore.Jet.OleDb/EFCore.Jet.OleDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<PackageTags>$(PackageTags);OLE DB;OLEDB;System.Data.OleDb</PackageTags>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,10 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.EntityFrameworkCore.Diagnostics" />
<Using Include="System.Diagnostics" />
<Using Include="System.Diagnostics.CodeAnalysis" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/EFCore.Jet/EFCore.Jet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup Condition="'$(LocalEFCoreRepository)' == ''">
<PackageReference Include="Microsoft.EntityFrameworkCore" PrivateAssets="none" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" PrivateAssets="none" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.0-rc.2.*" PrivateAssets="none" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.0-rc.2.*" PrivateAssets="none" />
</ItemGroup>

<ItemGroup Condition="'$(LocalEFCoreRepository)' != ''">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public override int ExecuteNonQuery(
output += base.ExecuteNonQuery(batch.Item1, connection, executionState, true, isolationLevel);
if (batch.Item2) Thread.Sleep(4000);//Wait for adox/dao to complete
}
if (connection.CurrentTransaction != null)
{
connection.CurrentTransaction.Commit();
}

connection.CurrentTransaction?.Commit();
return output;
}

Expand Down
14 changes: 11 additions & 3 deletions src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
using EntityFrameworkCore.Jet.Metadata.Internal;
using EntityFrameworkCore.Jet.Migrations.Operations;
using EntityFrameworkCore.Jet.Storage.Internal;
using EntityFrameworkCore.Jet.Update.Internal;
using EntityFrameworkCore.Jet.Utilities;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.Text;
using EntityFrameworkCore.Jet.Update.Internal;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore.Migrations
Expand Down Expand Up @@ -840,7 +841,7 @@ protected override void ColumnDefinition(
DefaultValue(operation.DefaultValue, operation.DefaultValueSql, columnType, builder);
}

protected override string? GetColumnType(
protected override string GetColumnType(
string? schema,
string table,
string name,
Expand Down Expand Up @@ -878,7 +879,14 @@ operation[JetAnnotationNames.Identity] is string identity &&
storeType = storeType.Replace("bigint", "decimal");
}

return storeType;
if (storeType != null)
{
return storeType;
}

var fullTableName = schema != null ? $"{schema}.{table}" : table;
throw new InvalidOperationException(
RelationalStrings.UnsupportedTypeForColumn(fullTableName, name, operation.ClrType?.Name ?? "unknown"));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class JetConvertTranslator(ISqlExpressionFactory sqlExpressionFactory) :
typeof(int),
typeof(long),
typeof(short),
typeof(string)
typeof(string),
typeof(object)
];

private static readonly IEnumerable<MethodInfo> _supportedMethods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ namespace EntityFrameworkCore.Jet.Query.ExpressionTranslators.Internal;
/// </remarks>
public class JetDateOnlyMemberTranslator(ISqlExpressionFactory sqlExpressionFactory) : IMemberTranslator
{
private static readonly Dictionary<string, string> DatePartMapping
= new()
{
{ nameof(DateTime.Year), "yyyy" },
{ nameof(DateTime.Month), "m" },
{ nameof(DateTime.DayOfYear), "y" },
{ nameof(DateTime.Day), "d" }
};

private readonly ISqlExpressionFactory _sqlExpressionFactory = sqlExpressionFactory;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand All @@ -41,12 +30,39 @@ private static readonly Dictionary<string, string> DatePartMapping
MemberInfo member,
Type returnType,
IDiagnosticsLogger<DbLoggerCategory.Query> logger)
=> member.DeclaringType == typeof(DateOnly) && DatePartMapping.TryGetValue(member.Name, out var datePart)
? _sqlExpressionFactory.Function(
{
if (member.DeclaringType != typeof(DateOnly) || instance is null)
{
return null;
}

return member.Name switch
{
nameof(DateOnly.Year) => DatePart("yyyy"),
nameof(DateOnly.Month) => DatePart("m"),
nameof(DateOnly.DayOfYear) => DatePart("y"),
nameof(DateOnly.Day) => DatePart("d"),

nameof(DateOnly.DayNumber) => sqlExpressionFactory.Add(sqlExpressionFactory.Function(
"DATEDIFF",
[
sqlExpressionFactory.Constant("d"),
sqlExpressionFactory.Constant(new DateOnly(100, 1, 1)),
instance
],
nullable: true,
argumentsPropagateNullability: [false, true, true],
returnType),sqlExpressionFactory.Constant(new DateOnly(100,1,1).DayNumber)),

_ => null
};

SqlExpression DatePart(string datePart)
=> sqlExpressionFactory.Function(
"DATEPART",
[_sqlExpressionFactory.Constant(datePart), instance!],
[sqlExpressionFactory.Constant(datePart), instance],
nullable: true,
argumentsPropagateNullability: [false, true],
returnType)
: null;
returnType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class JetDateOnlyMethodTranslator(ISqlExpressionFactory sqlExpressionFact
{ typeof(DateOnly).GetRuntimeMethod(nameof(DateOnly.AddDays), [typeof(int)])!, "d" }
};

private static readonly MethodInfo ToDateTimeMethodInfo
= typeof(DateOnly).GetRuntimeMethod(nameof(DateOnly.ToDateTime), [typeof(TimeOnly)])!;

private readonly ISqlExpressionFactory _sqlExpressionFactory = sqlExpressionFactory;

/// <summary>
Expand All @@ -40,27 +43,107 @@ public class JetDateOnlyMethodTranslator(ISqlExpressionFactory sqlExpressionFact
IReadOnlyList<SqlExpression> arguments,
IDiagnosticsLogger<DbLoggerCategory.Query> logger)
{
if (_methodInfoDatePartMapping.TryGetValue(method, out var datePart)
&& instance != null)
if (instance != null)
{
instance = _sqlExpressionFactory.ApplyDefaultTypeMapping(instance);
if (method == ToDateTimeMethodInfo)
{
var timeOnly = arguments[0];

return _sqlExpressionFactory.Function(
"DATEADD",
[_sqlExpressionFactory.Constant(datePart), _sqlExpressionFactory.Convert(arguments[0], typeof(int)), instance],
nullable: true,
argumentsPropagateNullability: [false, false, true],
instance.Type,
instance.TypeMapping);
// We need to refrain from doing the translation when either the DateOnly or the TimeOnly
// are a complex SQL expression (anything other than a column/constant/parameter), to avoid evaluating them multiple
// potentially expensive arbitrary expressions multiple times.
if (instance is not ColumnExpression and not SqlParameterExpression and not SqlConstantExpression
|| timeOnly is not ColumnExpression and not SqlParameterExpression and not SqlConstantExpression)
{
return null;
}

return _sqlExpressionFactory.Function(
"DATETIME2FROMPARTS",
[
MapDatePartExpression("yyyy", instance),
MapDatePartExpression("m", instance),
MapDatePartExpression("d", instance),
MapDatePartExpression("h", timeOnly),
MapDatePartExpression("n", timeOnly),
MapDatePartExpression("s", timeOnly),
MapDatePartExpression("fraction", timeOnly),
_sqlExpressionFactory.Constant(7, typeof(int)),
],
nullable: true,
argumentsPropagateNullability: [true, true, true, true, true, true, true, false],
typeof(DateTime));
}

if (_methodInfoDatePartMapping.TryGetValue(method, out var datePart))
{
instance = _sqlExpressionFactory.ApplyDefaultTypeMapping(instance);

return _sqlExpressionFactory.Function(
"DATEADD",
[_sqlExpressionFactory.Constant(datePart), _sqlExpressionFactory.Convert(arguments[0], typeof(int)), instance],
nullable: true,
argumentsPropagateNullability: [false, false, true],
instance.Type,
instance.TypeMapping);
}
}


if (method.DeclaringType == typeof(DateOnly)
&& method.Name == nameof(DateOnly.FromDateTime)
&& arguments.Count == 1)
{
return _sqlExpressionFactory.Convert(arguments[0], typeof(DateOnly));
return _sqlExpressionFactory.Function(
"DATEVALUE",
[arguments[0]],
nullable: true,
argumentsPropagateNullability: [false],
method.ReturnType);
}

return null;
}

private SqlExpression MapDatePartExpression(string datepart, SqlExpression argument)
{
if (argument is SqlConstantExpression constantArgument)
{
var constant = datepart switch
{
"yyyy" => ((DateOnly)constantArgument.Value!).Year,
"m" => ((DateOnly)constantArgument.Value!).Month,
"d" => ((DateOnly)constantArgument.Value!).Day,
"h" => ((TimeOnly)constantArgument.Value!).Hour,
"n" => ((TimeOnly)constantArgument.Value!).Minute,
"s" => ((TimeOnly)constantArgument.Value!).Second,
"fraction" => ((TimeOnly)constantArgument.Value!).Ticks % 10_000_000,

_ => throw new UnreachableException()
};

return _sqlExpressionFactory.Constant(constant, typeof(int));
}

if (datepart == "fraction")
{
return _sqlExpressionFactory.Divide(
_sqlExpressionFactory.Function(
"DATEPART",
[_sqlExpressionFactory.Fragment("nanosecond"), argument],
nullable: true,
argumentsPropagateNullability: [true, true],
typeof(int)
),
_sqlExpressionFactory.Constant(100, typeof(int))
);
}

return _sqlExpressionFactory.Function(
"DATEPART",
[_sqlExpressionFactory.Constant(datepart), argument],
nullable: true,
argumentsPropagateNullability: [true, true],
typeof(int));
}
}
10 changes: 7 additions & 3 deletions src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public virtual Expression Process(Expression expression)
}

selectExpression.ClearOrdering();
var limit = selectExpression.Limit;
//Keep the limit in parent expression
if (selectExpression.Limit != null)
if (limit != null)
{
var limit = selectExpression.Limit;
MethodInfo? dynMethod1 = selectExpression.GetType().GetMethod("set_Limit",
BindingFlags.NonPublic | BindingFlags.Instance);
dynMethod1?.Invoke(selectExpression, [null]);
Expand All @@ -111,7 +111,6 @@ public virtual Expression Process(Expression expression)
selectExpression.Orderings, null, null);*/
selectExpression = AddAliasManager(selectExpression);
selectExpression.PushdownIntoSubquery();
selectExpression.ApplyLimit(limit);
}
else
{
Expand All @@ -136,6 +135,11 @@ public virtual Expression Process(Expression expression)
}
}

if (limit != null)
{
selectExpression.ApplyLimit(limit);
}

if (isscalarselect && selectExpression.Projection.Count > 1)
{
List<ProjectionExpression> newProjections = [selectExpression.Projection[0]];
Expand Down
Loading
Loading