Skip to content

Commit 5a08cee

Browse files
committed
Sync to EF 10.0.0-preview.3
1 parent 908e207 commit 5a08cee

File tree

39 files changed

+2850
-334
lines changed

39 files changed

+2850
-334
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>enable</Nullable>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
88
<AnalysisLevel>latest</AnalysisLevel>
9-
<NoWarn>NU5105</NoWarn>
9+
<NoWarn>$(NoWarn);NU5105</NoWarn> <!-- The package version '1.2.3+semver2.metadata' uses SemVer 2.0.0 or components of SemVer 1.0.0 that are not supported on legacy clients. -->
1010
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1111
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Npgsql.snk</AssemblyOriginatorKeyFile>
1212
<SignAssembly>true</SignAssembly>

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<EFCoreVersion>10.0.0-preview.2.25163.8</EFCoreVersion>
4-
<MicrosoftExtensionsVersion>10.0.0-preview.2.25163.2</MicrosoftExtensionsVersion>
3+
<EFCoreVersion>10.0.0-preview.3.25171.6</EFCoreVersion>
4+
<MicrosoftExtensionsVersion>10.0.0-preview.3.25171.5</MicrosoftExtensionsVersion>
55
<NpgsqlVersion>9.0.3</NpgsqlVersion>
66
</PropertyGroup>
77

@@ -26,7 +26,7 @@
2626
<PackageVersion Include="xunit" Version="2.9.2" />
2727
<PackageVersion Include="xunit.assert" Version="2.9.2" />
2828
<PackageVersion Include="xunit.core" Version="2.9.2" />
29-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
29+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
3030
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
3131
</ItemGroup>
3232
</Project>

src/EFCore.PG/Metadata/Conventions/NpgsqlConventionSetBuilder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public override ConventionSet CreateConventionSet()
5151
conventionSet.ModelInitializedConventions.Add(
5252
new RelationalMaxIdentifierLengthConvention(63, Dependencies, RelationalDependencies));
5353

54-
conventionSet.PropertyAddedConventions.Add(new NpgsqlJsonElementHackConvention());
55-
5654
ValueGenerationConvention valueGenerationConvention = new NpgsqlValueGenerationConvention(Dependencies, RelationalDependencies);
5755
ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention);
5856

src/EFCore.PG/Metadata/Conventions/NpgsqlJsonElementHackConvention.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ public NpgsqlTypeMappingSource(
314314
{ typeof(BigInteger), _bigInteger },
315315
{ typeof(string), _text },
316316
{ typeof(JsonDocument), _jsonbDocument },
317-
// { typeof(JsonElement), _jsonbElement },
318-
{ typeof(JsonElement), _jsonbOwned },
317+
{ typeof(JsonElement), _jsonbElement },
318+
{ typeof(JsonTypePlaceholder), _jsonbOwned },
319319
{ typeof(char), _singleChar },
320320
{ typeof(DateTime), LegacyTimestampBehavior ? _timestamp : _timestamptz },
321321
{ typeof(DateOnly), _dateDateOnly },

test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace Microsoft.EntityFrameworkCore;
22

33
// ReSharper disable once UnusedMember.Global
4-
public class LazyLoadProxyNpgsqlTest : LazyLoadProxyTestBase<LazyLoadProxyNpgsqlTest.LoadNpgsqlFixture>
4+
public class LazyLoadProxyNpgsqlTest : LazyLoadProxyRelationalTestBase<LazyLoadProxyNpgsqlTest.LoadNpgsqlFixture>
55
{
66
public LazyLoadProxyNpgsqlTest(LoadNpgsqlFixture fixture)
77
: base(fixture)
@@ -1491,7 +1491,7 @@ protected override string SerializedBlogs1
14911491

14921492
#endregion Expected JSON override
14931493

1494-
public class LoadNpgsqlFixture : LoadFixtureBase
1494+
public class LoadNpgsqlFixture : LoadRelationalFixtureBase
14951495
{
14961496
public TestSqlLoggerFactory TestSqlLoggerFactory
14971497
=> (TestSqlLoggerFactory)ServiceProvider.GetRequiredService<ILoggerFactory>();

test/EFCore.PG.FunctionalTests/Query/AdHocJsonQueryNpgsqlTest.cs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Microsoft.EntityFrameworkCore.Query;
22

33
#nullable disable
44

5-
public class AdHocJsonQueryNpgsqlTest : AdHocJsonQueryTestBase
5+
public class AdHocJsonQueryNpgsqlTest : AdHocJsonQueryRelationalTestBase
66
{
77
protected override ITestStoreFactory TestStoreFactory
88
=> NpgsqlTestStoreFactory.Instance;
@@ -296,7 +296,7 @@ public class TypesJsonEntity
296296
public TimeSpan Interval { get; set; }
297297
}
298298

299-
#region 34960
299+
#region Problematc tests (Unspecified DateTime)
300300

301301
// These tests use a model with a non-UTC DateTime, which isn't supported in PG's timestamp with time zone
302302

@@ -309,12 +309,6 @@ public override Task Try_project_collection_but_JSON_is_entity()
309309
public override Task Try_project_reference_but_JSON_is_collection()
310310
=> Assert.ThrowsAsync<ArgumentException>(() => base.Try_project_reference_but_JSON_is_collection());
311311

312-
#endregion 34960
313-
314-
#region 34293
315-
316-
// These tests use a model with a non-UTC DateTime, which isn't supported in PG's timestamp with time zone
317-
318312
public override Task Project_entity_with_optional_json_entity_owned_by_required_json()
319313
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_entity_with_optional_json_entity_owned_by_required_json());
320314

@@ -324,7 +318,37 @@ public override Task Project_required_json_entity()
324318
public override Task Project_optional_json_entity_owned_by_required_json_entity()
325319
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_optional_json_entity_owned_by_required_json_entity());
326320

327-
#endregion 34293
321+
public override Task Project_missing_required_scalar(bool async)
322+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_missing_required_scalar(async));
323+
324+
public override Task Project_nested_json_entity_with_missing_scalars(bool async)
325+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_nested_json_entity_with_missing_scalars(async));
326+
327+
public override Task Project_null_required_scalar(bool async)
328+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_null_required_scalar(async));
329+
330+
public override Task Project_root_entity_with_missing_required_navigation(bool async)
331+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_entity_with_missing_required_navigation(async));
332+
333+
public override Task Project_root_entity_with_null_required_navigation(bool async)
334+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_entity_with_null_required_navigation(async));
335+
336+
public override Task Project_root_with_missing_scalars(bool async)
337+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_with_missing_scalars(async));
338+
339+
public override Task Project_top_level_json_entity_with_missing_scalars(bool async)
340+
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_top_level_json_entity_with_missing_scalars(async));
341+
342+
public override Task Project_missing_required_navigation(bool async)
343+
=> Task.CompletedTask; // Different exception expected in the base implementation
344+
345+
public override Task Project_null_required_navigation(bool async)
346+
=> Task.CompletedTask; // Different exception expected in the base implementation
347+
348+
public override Task Project_top_level_entity_with_null_value_required_scalars(bool async)
349+
=> Task.CompletedTask; // Different exception expected in the base implementation
350+
351+
#endregion Problematc tests (Unspecified DateTime)
328352

329353
protected void AssertSql(params string[] expected)
330354
=> TestSqlLoggerFactory.AssertBaseline(expected);

test/EFCore.PG.FunctionalTests/Query/AdHocMiscellaneousQueryNpgsqlTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
2+
13
namespace Microsoft.EntityFrameworkCore.Query;
24

35
public class AdHocMiscellaneousQueryNpgsqlTest : AdHocMiscellaneousQueryRelationalTestBase
46
{
57
protected override ITestStoreFactory TestStoreFactory
68
=> NpgsqlTestStoreFactory.Instance;
79

10+
protected override DbContextOptionsBuilder SetTranslateParameterizedCollectionsToConstants(DbContextOptionsBuilder optionsBuilder)
11+
{
12+
new NpgsqlDbContextOptionsBuilder(optionsBuilder).TranslateParameterizedCollectionsToConstants();
13+
14+
return optionsBuilder;
15+
}
16+
17+
// Unlike the other providers, EFCore.PG does actually support mapping JsonElement
18+
public override Task Mapping_JsonElement_property_throws_a_meaningful_exception()
19+
=> Task.CompletedTask;
20+
821
protected override Task Seed2951(Context2951 context)
922
=> context.Database.ExecuteSqlRawAsync(
1023
"""

test/EFCore.PG.FunctionalTests/Query/CompatibilityQueryNpgsqlTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task Array_contains_is_not_parameterized_with_array_on_redshift()
2525
"""
2626
SELECT t."Id", t."SomeInt"
2727
FROM "TestEntities" AS t
28-
WHERE t."SomeInt" IN (8, 9)
28+
WHERE t."SomeInt" IN (?, ?)
2929
LIMIT 2
3030
""");
3131
}

0 commit comments

Comments
 (0)