Skip to content

Commit 6068de4

Browse files
authored
Depend on EF 10.0.0-alpha.1.24610.3 (#3409)
1 parent af11162 commit 6068de4

File tree

56 files changed

+1534
-1271
lines changed

Some content is hidden

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

56 files changed

+1534
-1271
lines changed

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<EFCoreVersion>[9.0.0,10.0.0)</EFCoreVersion>
4-
<MicrosoftExtensionsVersion>9.0.0</MicrosoftExtensionsVersion>
3+
<EFCoreVersion>10.0.0-alpha.1.24610.3</EFCoreVersion>
4+
<MicrosoftExtensionsVersion>10.0.0-alpha.1.24609.1</MicrosoftExtensionsVersion>
55
<NpgsqlVersion>9.0.2</NpgsqlVersion>
66
</PropertyGroup>
77

@@ -23,9 +23,9 @@
2323

2424
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
2525
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
26-
<PackageVersion Include="xunit" Version="2.9.0" />
27-
<PackageVersion Include="xunit.assert" Version="2.9.0" />
28-
<PackageVersion Include="xunit.core" Version="2.9.0" />
26+
<PackageVersion Include="xunit" Version="2.9.2" />
27+
<PackageVersion Include="xunit.assert" Version="2.9.2" />
28+
<PackageVersion Include="xunit.core" Version="2.9.2" />
2929
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
3030
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
3131
</ItemGroup>

src/EFCore.PG/Migrations/Internal/NpgsqlHistoryRepository.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ or PostgresErrorCodes.DuplicateTable
177177
private IReadOnlyList<MigrationCommand> GetCreateIfNotExistsCommands()
178178
=> Dependencies.MigrationsSqlGenerator.Generate([new SqlOperation
179179
{
180-
Sql = GetCreateIfNotExistsScript(),
181-
SuppressTransaction = true
180+
Sql = GetCreateIfNotExistsScript()
182181
}]);
183182

184183
/// <summary>

src/EFCore.PG/Query/Internal/NpgsqlDeleteConvertingExpressionVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query.Internal;
44

55
/// <summary>
6-
/// Converts the relational <see cref="NonQueryExpression" /> into a PG-specific <see cref="PgDeleteExpression" />, which
6+
/// Converts the relational <see cref="DeleteExpression" /> into a PG-specific <see cref="PgDeleteExpression" />, which
77
/// precisely models a DELETE statement in PostgreSQL. This is done to handle the PG-specific USING syntax for table joining.
88
/// </summary>
99
public class NpgsqlDeleteConvertingExpressionVisitor : ExpressionVisitor

src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContext.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public NpgsqlQueryCompilationContext(
1818
QueryCompilationContextDependencies dependencies,
1919
RelationalQueryCompilationContextDependencies relationalDependencies,
2020
bool async)
21-
: this(
22-
dependencies, relationalDependencies, async, precompiling: false,
23-
nonNullableReferenceTypeParameters: null)
21+
: this(dependencies, relationalDependencies, async, precompiling: false)
2422
{
2523
}
2624

@@ -34,9 +32,8 @@ public NpgsqlQueryCompilationContext(
3432
QueryCompilationContextDependencies dependencies,
3533
RelationalQueryCompilationContextDependencies relationalDependencies,
3634
bool async,
37-
bool precompiling,
38-
IReadOnlySet<string>? nonNullableReferenceTypeParameters)
39-
: base(dependencies, relationalDependencies, async, precompiling, nonNullableReferenceTypeParameters)
35+
bool precompiling)
36+
: base(dependencies, relationalDependencies, async, precompiling)
4037
{
4138
}
4239

src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContextFactory.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public virtual QueryCompilationContext Create(bool async)
4343
/// any release. You should only use it directly in your code with extreme caution and knowing that
4444
/// doing so can result in application failures when updating to a new Entity Framework Core release.
4545
/// </summary>
46-
public virtual QueryCompilationContext CreatePrecompiled(bool async, IReadOnlySet<string> nonNullableReferenceTypeParameters)
47-
=> new NpgsqlQueryCompilationContext(
48-
_dependencies, _relationalDependencies, async, precompiling: true,
49-
nonNullableReferenceTypeParameters);
46+
public virtual QueryCompilationContext CreatePrecompiled(bool async)
47+
=> new NpgsqlQueryCompilationContext(_dependencies, _relationalDependencies, async, precompiling: true);
5048
}

src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,46 +1096,18 @@ protected override bool IsValidSelectExpressionForExecuteUpdate(
10961096
/// any release. You should only use it directly in your code with extreme caution and knowing that
10971097
/// doing so can result in application failures when updating to a new Entity Framework Core release.
10981098
/// </summary>
1099-
protected override bool IsValidSelectExpressionForExecuteDelete(
1100-
SelectExpression selectExpression,
1101-
StructuralTypeShaperExpression shaper,
1102-
[NotNullWhen(true)] out TableExpression? tableExpression)
1103-
{
1099+
protected override bool IsValidSelectExpressionForExecuteDelete(SelectExpression selectExpression)
11041100
// The default relational behavior is to allow only single-table expressions, and the only permitted feature is a predicate.
11051101
// Here we extend this to also inner joins to tables, which we generate via the PostgreSQL-specific USING construct.
1106-
if (selectExpression is
1107-
{
1108-
Orderings: [],
1109-
Offset: null,
1110-
Limit: null,
1111-
GroupBy: [],
1112-
Having: null
1113-
})
1102+
=> selectExpression is
11141103
{
1115-
TableExpressionBase? table = null;
1116-
if (selectExpression.Tables.Count == 1)
1117-
{
1118-
table = selectExpression.Tables[0];
1119-
}
1120-
else if (selectExpression.Tables.All(t => t is TableExpression or InnerJoinExpression))
1121-
{
1122-
var projectionBindingExpression = (ProjectionBindingExpression)shaper.ValueBufferExpression;
1123-
var entityProjectionExpression =
1124-
(StructuralTypeProjectionExpression)selectExpression.GetProjection(projectionBindingExpression);
1125-
var column = entityProjectionExpression.BindProperty(shaper.StructuralType.GetProperties().First());
1126-
table = selectExpression.Tables.Select(t => t.UnwrapJoin()).Single(t => t.Alias == column.TableAlias);
1127-
}
1128-
1129-
if (table is TableExpression te)
1130-
{
1131-
tableExpression = te;
1132-
return true;
1133-
}
1104+
Orderings: [],
1105+
Offset: null,
1106+
Limit: null,
1107+
GroupBy: [],
1108+
Having: null
11341109
}
1135-
1136-
tableExpression = null;
1137-
return false;
1138-
}
1110+
&& selectExpression.Tables[0] is TableExpression && selectExpression.Tables.Skip(1).All(t => t is InnerJoinExpression);
11391111

11401112
// PostgreSQL unnest is guaranteed to return output rows in the same order as its input array,
11411113
// https://www.postgresql.org/docs/current/functions-array.html.

src/EFCore.PG/Query/Internal/NpgsqlSqlTranslatingExpressionVisitor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ private bool TryTranslateStartsEndsWithContains(
518518
return true;
519519
}
520520

521-
case SqlParameterExpression patternParameter
522-
when patternParameter.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal):
521+
case SqlParameterExpression patternParameter:
523522
{
524523
// The pattern is a parameter, register a runtime parameter that will contain the rewritten LIKE pattern, where
525524
// all special characters have been escaped.

src/EFCore.PG/Storage/Internal/Mapping/NpgsqlArrayTypeMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private static RelationalTypeMappingParameters CreateParameters(string storeType
132132
var comparer = typeof(TCollection).IsArray && typeof(TCollection).GetArrayRank() > 1
133133
? null // TODO: Value comparer for multidimensional arrays
134134
: (ValueComparer?)Activator.CreateInstance(
135-
elementType.IsNullableValueType()
135+
elementType.IsNullableValueType() || elementMapping.Comparer.Type.IsNullableValueType()
136136
? typeof(ListOfNullableValueTypesComparer<,>)
137137
.MakeGenericType(typeof(TConcreteCollection), elementType.UnwrapNullableType())
138138
: elementType.IsValueType

test/EFCore.PG.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ public void Sql_translation_uses_type_mapper_when_parameter()
4848

4949
AssertSql(
5050
"""
51-
@__timeSpan_0='02:01:00' (Nullable = true)
51+
@timeSpan='02:01:00' (Nullable = true)
5252
5353
SELECT m."Int"
5454
FROM "MappedNullableDataTypes" AS m
55-
WHERE m."TimeSpanAsTime" = @__timeSpan_0
55+
WHERE m."TimeSpanAsTime" = @timeSpan
5656
""");
5757
}
5858

test/EFCore.PG.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesNpgsqlTest.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,20 @@ public override async Task Update_complex_type_to_parameter(bool async)
100100

101101
AssertExecuteUpdateSql(
102102
"""
103-
@__complex_type_newAddress_0_AddressLine1='New AddressLine1'
104-
@__complex_type_newAddress_0_AddressLine2='New AddressLine2'
105-
@__complex_type_newAddress_0_Tags={ 'new_tag1', 'new_tag2' } (DbType = Object)
106-
@__complex_type_newAddress_0_ZipCode='99999' (Nullable = true)
107-
@__complex_type_newAddress_0_Code='FR'
108-
@__complex_type_newAddress_0_FullName='France'
103+
@complex_type_newAddress_AddressLine1='New AddressLine1'
104+
@complex_type_newAddress_AddressLine2='New AddressLine2'
105+
@complex_type_newAddress_Tags={ 'new_tag1', 'new_tag2' } (DbType = Object)
106+
@complex_type_newAddress_ZipCode='99999' (Nullable = true)
107+
@complex_type_newAddress_Code='FR'
108+
@complex_type_newAddress_FullName='France'
109109
110110
UPDATE "Customer" AS c
111-
SET "ShippingAddress_AddressLine1" = @__complex_type_newAddress_0_AddressLine1,
112-
"ShippingAddress_AddressLine2" = @__complex_type_newAddress_0_AddressLine2,
113-
"ShippingAddress_Tags" = @__complex_type_newAddress_0_Tags,
114-
"ShippingAddress_ZipCode" = @__complex_type_newAddress_0_ZipCode,
115-
"ShippingAddress_Country_Code" = @__complex_type_newAddress_0_Code,
116-
"ShippingAddress_Country_FullName" = @__complex_type_newAddress_0_FullName
111+
SET "ShippingAddress_AddressLine1" = @complex_type_newAddress_AddressLine1,
112+
"ShippingAddress_AddressLine2" = @complex_type_newAddress_AddressLine2,
113+
"ShippingAddress_Tags" = @complex_type_newAddress_Tags,
114+
"ShippingAddress_ZipCode" = @complex_type_newAddress_ZipCode,
115+
"ShippingAddress_Country_Code" = @complex_type_newAddress_Code,
116+
"ShippingAddress_Country_FullName" = @complex_type_newAddress_FullName
117117
""");
118118
}
119119

@@ -123,12 +123,12 @@ public override async Task Update_nested_complex_type_to_parameter(bool async)
123123

124124
AssertExecuteUpdateSql(
125125
"""
126-
@__complex_type_newCountry_0_Code='FR'
127-
@__complex_type_newCountry_0_FullName='France'
126+
@complex_type_newCountry_Code='FR'
127+
@complex_type_newCountry_FullName='France'
128128
129129
UPDATE "Customer" AS c
130-
SET "ShippingAddress_Country_Code" = @__complex_type_newCountry_0_Code,
131-
"ShippingAddress_Country_FullName" = @__complex_type_newCountry_0_FullName
130+
SET "ShippingAddress_Country_Code" = @complex_type_newCountry_Code,
131+
"ShippingAddress_Country_FullName" = @complex_type_newCountry_FullName
132132
""");
133133
}
134134

@@ -186,7 +186,7 @@ public override async Task Update_complex_type_to_another_database_complex_type_
186186

187187
AssertExecuteUpdateSql(
188188
"""
189-
@__p_0='1'
189+
@p='1'
190190
191191
UPDATE "Customer" AS c0
192192
SET "ShippingAddress_AddressLine1" = c1."BillingAddress_AddressLine1",
@@ -199,7 +199,7 @@ public override async Task Update_complex_type_to_another_database_complex_type_
199199
SELECT c."Id", c."BillingAddress_AddressLine1", c."BillingAddress_AddressLine2", c."BillingAddress_Tags", c."BillingAddress_ZipCode", c."ShippingAddress_Country_Code", c."ShippingAddress_Country_FullName"
200200
FROM "Customer" AS c
201201
ORDER BY c."Id" NULLS FIRST
202-
OFFSET @__p_0
202+
OFFSET @p
203203
) AS c1
204204
WHERE c0."Id" = c1."Id"
205205
""");

0 commit comments

Comments
 (0)