Skip to content

Commit da54696

Browse files
committed
initial net10 update
1 parent f72fd5f commit da54696

158 files changed

Lines changed: 21205 additions & 18687 deletions

File tree

Some content is hidden

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

Dependencies.targets

Lines changed: 3 additions & 3 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.5.25277.114,10.0.999]</DotNetVersion>
4+
<EFCoreVersion>[10.0.0-preview.5.25277.114,10.0.999]</EFCoreVersion>
5+
<MSLibVersion>[10.0.0-preview.5.25277.114,10.0.999]</MSLibVersion>
66
</PropertyGroup>
77

88
<ItemGroup>

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

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.5.25277.114",
4+
"allowPrerelease": true,
55
"rollForward": "latestFeature"
66
}
77
}

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
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ private sealed class SkipWithoutOrderByInSplitQueryVerifier : ExpressionVisitor
7272
case SelectExpression { Offset: not null, Orderings.Count: 0 }:
7373
throw new InvalidOperationException(JetStrings.SplitQueryOffsetWithoutOrderBy);
7474

75-
case NonQueryExpression nonQueryExpression:
76-
return nonQueryExpression;
75+
case UpdateExpression or DeleteExpression:
76+
return expression;
7777

7878
default:
7979
return base.Visit(expression);

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,42 +76,30 @@ protected override ShapedQueryExpression?
7676
/// doing so can result in application failures when updating to a new Entity Framework Core release.
7777
/// </summary>
7878
protected override bool IsValidSelectExpressionForExecuteDelete(
79-
SelectExpression selectExpression,
80-
StructuralTypeShaperExpression shaper,
81-
[NotNullWhen(true)] out TableExpression? tableExpression)
79+
SelectExpression selectExpression)
8280
{
8381
if (selectExpression.Offset == null
8482
&& selectExpression.GroupBy.Count == 0
8583
&& selectExpression.Having == null
8684
&& selectExpression.Orderings.Count == 0
8785
&& selectExpression.Limit == null)
8886
{
89-
TableExpressionBase table;
87+
TableExpressionBase? table;
9088
if (selectExpression.Tables.Count == 1)
9189
{
9290
table = selectExpression.Tables[0];
9391
}
9492
else
9593
{
96-
var projectionBindingExpression = (ProjectionBindingExpression)shaper.ValueBufferExpression;
97-
var projection = (StructuralTypeProjectionExpression)selectExpression.GetProjection(projectionBindingExpression);
98-
var column = projection.BindProperty(shaper.StructuralType.GetProperties().First());
99-
table = selectExpression.GetTable(column).UnwrapJoin();
100-
//TODO: do I need the following given we now have an unwrapjoin in the above line?
101-
if (table is JoinExpressionBase joinExpressionBase)
102-
{
103-
table = joinExpressionBase.Table;
104-
}
94+
table = null;
10595
}
10696

10797
if (table is TableExpression te)
10898
{
109-
tableExpression = te;
11099
return true;
111100
}
112101
}
113102

114-
tableExpression = null;
115103
return false;
116104
}
117105

0 commit comments

Comments
 (0)