Skip to content

Commit 2e33783

Browse files
authored
Update to EF10 (#284)
1 parent d64bc37 commit 2e33783

File tree

163 files changed

+21593
-20134
lines changed

Some content is hidden

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

163 files changed

+21593
-20134
lines changed

Dependencies.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<DotNetVersion>[9.0.6,9.0.999]</DotNetVersion>
4-
<EFCoreVersion>[9.0.6,9.0.999]</EFCoreVersion>
5-
<MSLibVersion>[9.0.6,9.0.999]</MSLibVersion>
3+
<DotNetVersion>[10.0.0-preview.6.25358.103,10.0.999]</DotNetVersion>
4+
<EFCoreVersion>[10.0.0-preview.6.25358.103,10.0.999]</EFCoreVersion>
5+
<MSLibVersion>[10.0.0-preview.6.25358.103,10.0.999]</MSLibVersion>
66
</PropertyGroup>
77

88
<ItemGroup>
@@ -37,7 +37,7 @@
3737
<!-- EFCore.Jet.FunctionalTests -->
3838
<PackageReference Update="xunit.core" Version="2.9.3"/>
3939
<PackageReference Update="xunit.assert" Version="2.9.3" />
40-
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.1" />
40+
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.2" />
4141
<PackageReference Update="xunit.runner.console" Version="2.9.3" />
4242
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="$(MSLibVersion)" />
4343
<PackageReference Update="NetTopologySuite" Version="2.5.0" />

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Company>CirrusRed</Company>
99
<Copyright>Copyright © 2017-$([System.DateTime]::Now.Year) CirrusRed</Copyright>
1010
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
11-
<LangVersion>13.0</LangVersion>
11+
<LangVersion>preview</LangVersion>
1212
<Nullable>enable</Nullable>
1313
<DebugType>portable</DebugType>
1414
<IsPackable>False</IsPackable>
@@ -24,10 +24,10 @@
2424
</PropertyGroup>
2525

2626
<PropertyGroup>
27-
<EfCoreTargetFramework>net8.0</EfCoreTargetFramework>
27+
<EfCoreTargetFramework>net10.0</EfCoreTargetFramework>
2828
<EfCoreTestTargetFramework>$(EfCoreTargetFramework)</EfCoreTestTargetFramework>
2929
<JetTargetFramework>$(EfCoreTargetFramework)</JetTargetFramework>
30-
<JetTestTargetFramework>net9.0</JetTestTargetFramework>
30+
<JetTestTargetFramework>net10.0</JetTestTargetFramework>
3131
<JetTestWindowsOnlyTargetFramework>$(JetTestTargetFramework)-windows7.0</JetTestWindowsOnlyTargetFramework>
3232
</PropertyGroup>
3333

Version.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
Bump-up to the next iteration immediately after a release, so that subsequent daily builds are named
1616
correctly.
1717
-->
18-
<VersionPrefix>9.0.1</VersionPrefix>
19-
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
20-
<PreReleaseVersionIteration>0</PreReleaseVersionIteration>
18+
<VersionPrefix>10.0.0</VersionPrefix>
19+
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
20+
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
2121

2222
<!--
2323
The following properties will automatically be set by CI builds when appropriate:

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
3-
"version": "9.0.100",
4-
"allowPrerelease": false,
3+
"version": "10.0.100-preview.6.25358.103",
4+
"allowPrerelease": true,
55
"rollForward": "latestFeature"
66
}
77
}

src/EFCore.Jet.Data/JetDataReader.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,5 +544,17 @@ public override T GetFieldValue<T>(int ordinal)
544544

545545
return (T)GetValue(ordinal);
546546
}
547+
548+
protected override void Dispose(bool disposing)
549+
{
550+
if (disposing)
551+
{
552+
_wrappedDataReader.Dispose();
553+
}
554+
#if DEBUG
555+
Interlocked.Decrement(ref _activeObjectsCount);
556+
#endif
557+
base.Dispose(disposing);
558+
}
547559
}
548560
}

src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@ public class JetStringMethodTranslator(ISqlExpressionFactory sqlExpressionFactor
1414
{
1515
private readonly JetSqlExpressionFactory _sqlExpressionFactory = (JetSqlExpressionFactory)sqlExpressionFactory;
1616

17-
private static readonly MethodInfo IndexOfMethodInfo
17+
private static readonly MethodInfo IndexOfMethodInfoString
1818
= typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(string)])!;
1919

20-
private static readonly MethodInfo IndexOfMethodInfoWithStartingPosition
20+
private static readonly MethodInfo IndexOfMethodInfoChar
21+
= typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(char)])!;
22+
23+
private static readonly MethodInfo IndexOfMethodInfoWithStartingPositionString
2124
= typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(string), typeof(int)])!;
2225

23-
private static readonly MethodInfo _replaceMethodInfo
26+
private static readonly MethodInfo IndexOfMethodInfoWithStartingPositionChar
27+
= typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(char), typeof(int)])!;
28+
29+
private static readonly MethodInfo ReplaceMethodInfoString
2430
= typeof(string).GetRuntimeMethod(nameof(string.Replace), [typeof(string), typeof(string)])!;
2531

32+
private static readonly MethodInfo ReplaceMethodInfoChar
33+
= typeof(string).GetRuntimeMethod(nameof(string.Replace), [typeof(char), typeof(char)])!;
34+
2635
private static readonly MethodInfo _toLowerMethodInfo
2736
= typeof(string).GetRuntimeMethod(nameof(string.ToLower), Type.EmptyTypes)!;
2837

@@ -76,16 +85,36 @@ private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs
7685
{
7786
if (instance != null)
7887
{
79-
if (IndexOfMethodInfo.Equals(method))
88+
if (IndexOfMethodInfoString.Equals(method) || IndexOfMethodInfoChar.Equals(method))
8089
{
8190
return TranslateIndexOf(instance, method, arguments[0], null);
8291
}
8392

84-
if (IndexOfMethodInfoWithStartingPosition.Equals(method))
93+
if (IndexOfMethodInfoWithStartingPositionString.Equals(method) || IndexOfMethodInfoWithStartingPositionChar.Equals(method))
8594
{
8695
return TranslateIndexOf(instance, method, arguments[0], arguments[1]);
8796
}
8897

98+
if (ReplaceMethodInfoString.Equals(method) || ReplaceMethodInfoChar.Equals(method))
99+
{
100+
var firstArgument = arguments[0];
101+
var secondArgument = arguments[1];
102+
var stringTypeMapping =
103+
ExpressionExtensions.InferTypeMapping(instance, firstArgument, secondArgument);
104+
105+
instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping);
106+
firstArgument = _sqlExpressionFactory.ApplyTypeMapping(firstArgument, firstArgument.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping);
107+
secondArgument = _sqlExpressionFactory.ApplyTypeMapping(secondArgument, secondArgument.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping);
108+
109+
return _sqlExpressionFactory.Function(
110+
"REPLACE",
111+
[instance, firstArgument, secondArgument],
112+
nullable: true,
113+
argumentsPropagateNullability: [true, true, true],
114+
method.ReturnType,
115+
stringTypeMapping);
116+
}
117+
89118
// Jet TRIM does not take arguments.
90119
// _trimWithNoParam is only available since .NET Core 2.0 (or .NET Standard 2.1).
91120
if (Equals(method, _trimMethodInfoWithoutArgs) ||
@@ -169,26 +198,6 @@ private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs
169198
method.ReturnType,
170199
instance.TypeMapping);
171200
}
172-
173-
if (_replaceMethodInfo.Equals(method))
174-
{
175-
var firstArgument = arguments[0];
176-
var secondArgument = arguments[1];
177-
var stringTypeMapping =
178-
ExpressionExtensions.InferTypeMapping(instance, firstArgument, secondArgument);
179-
180-
instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping);
181-
firstArgument = _sqlExpressionFactory.ApplyTypeMapping(firstArgument, stringTypeMapping);
182-
secondArgument = _sqlExpressionFactory.ApplyTypeMapping(secondArgument, stringTypeMapping);
183-
184-
return _sqlExpressionFactory.Function(
185-
"REPLACE",
186-
[instance, firstArgument, secondArgument],
187-
nullable: true,
188-
argumentsPropagateNullability: [true, true, true],
189-
method.ReturnType,
190-
stringTypeMapping);
191-
}
192201
}
193202

194203
if (_isNullOrEmptyMethodInfo.Equals(method))
@@ -267,7 +276,7 @@ private SqlExpression TranslateIndexOf(
267276
SqlExpression? startIndex)
268277
{
269278
var stringTypeMapping = ExpressionExtensions.InferTypeMapping(instance, searchExpression)!;
270-
searchExpression = _sqlExpressionFactory.ApplyTypeMapping(searchExpression, stringTypeMapping);
279+
searchExpression = _sqlExpressionFactory.ApplyTypeMapping(searchExpression, searchExpression.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping);
271280
instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping);
272281

273282
var charIndexArguments = new List<SqlExpression> { instance, searchExpression };

src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public virtual Expression Process(Expression expression)
5050
relationalSplitCollectionShaperExpression.ParentIdentifier,
5151
relationalSplitCollectionShaperExpression.ChildIdentifier, (SelectExpression)newSelect, newInner);
5252
return relationalSplitCollectionShaperExpression;
53-
case NonQueryExpression nonQueryExpression:
54-
return nonQueryExpression;
53+
case UpdateExpression or DeleteExpression:
54+
return expression;
5555
case SelectExpression selectExpression:
5656
{
5757
Dictionary<int, (int? indexcol, OrderingExpression? orderexp, bool ascend, bool rewrite, bool referstocurouter)> columnsToRewrite = [];

src/EFCore.Jet/Query/Internal/JetLocateScalarSubqueryVisitor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ protected override Expression VisitProjection(ProjectionExpression projectionExp
185185
return projectionExpression.Update(expression);
186186
}
187187

188+
protected override Expression VisitRightJoin(RightJoinExpression rightJoinExpression)
189+
{
190+
throw new NotImplementedException();
191+
}
192+
188193
protected override Expression VisitTableValuedFunction(TableValuedFunctionExpression tableValuedFunctionExpression)
189194
{
190195
var arguments = new SqlExpression[tableValuedFunctionExpression.Arguments.Count];

src/EFCore.Jet/Query/Internal/JetQueryCompilationContext.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public class JetQueryCompilationContext(
1616
QueryCompilationContextDependencies dependencies,
1717
RelationalQueryCompilationContextDependencies relationalDependencies,
1818
bool async,
19-
bool precompiling,
20-
IReadOnlySet<string>? nonNullableReferenceTypeParameters) : RelationalQueryCompilationContext(dependencies, relationalDependencies, async, precompiling, nonNullableReferenceTypeParameters)
19+
bool precompiling) : RelationalQueryCompilationContext(dependencies, relationalDependencies, async, precompiling)
2120
{
2221
/// <summary>
2322
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
@@ -30,8 +29,7 @@ public JetQueryCompilationContext(
3029
RelationalQueryCompilationContextDependencies relationalDependencies,
3130
bool async)
3231
: this(
33-
dependencies, relationalDependencies, async, precompiling: false,
34-
nonNullableReferenceTypeParameters: null)
32+
dependencies, relationalDependencies, async, precompiling: false)
3533
{
3634
}
3735

src/EFCore.Jet/Query/Internal/JetQueryCompilationContextFactory.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public virtual QueryCompilationContext Create(bool async)
4747
/// any release. You should only use it directly in your code with extreme caution and knowing that
4848
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4949
/// </summary>
50-
public virtual QueryCompilationContext CreatePrecompiled(bool async, IReadOnlySet<string> nonNullableReferenceTypeParameters)
50+
public virtual QueryCompilationContext CreatePrecompiled(bool async)
5151
=> new JetQueryCompilationContext(
52-
Dependencies, RelationalDependencies, async, precompiling: true,
53-
nonNullableReferenceTypeParameters);
52+
Dependencies, RelationalDependencies, async, precompiling: true);
5453
}

0 commit comments

Comments
 (0)