Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisLevel>latest</AnalysisLevel>
<NoWarn>NU5105</NoWarn>
<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. -->
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Npgsql.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
Expand Down
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<EFCoreVersion>10.0.0-preview.2.25163.8</EFCoreVersion>
<MicrosoftExtensionsVersion>10.0.0-preview.2.25163.2</MicrosoftExtensionsVersion>
<EFCoreVersion>10.0.0-preview.3.25171.6</EFCoreVersion>
<MicrosoftExtensionsVersion>10.0.0-preview.3.25171.5</MicrosoftExtensionsVersion>
<NpgsqlVersion>9.0.3</NpgsqlVersion>
</PropertyGroup>

Expand All @@ -26,7 +26,7 @@
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.assert" Version="2.9.2" />
<PackageVersion Include="xunit.core" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public override ConventionSet CreateConventionSet()
conventionSet.ModelInitializedConventions.Add(
new RelationalMaxIdentifierLengthConvention(63, Dependencies, RelationalDependencies));

conventionSet.PropertyAddedConventions.Add(new NpgsqlJsonElementHackConvention());

ValueGenerationConvention valueGenerationConvention = new NpgsqlValueGenerationConvention(Dependencies, RelationalDependencies);
ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention);

Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ public NpgsqlTypeMappingSource(
{ typeof(BigInteger), _bigInteger },
{ typeof(string), _text },
{ typeof(JsonDocument), _jsonbDocument },
// { typeof(JsonElement), _jsonbElement },
{ typeof(JsonElement), _jsonbOwned },
{ typeof(JsonElement), _jsonbElement },
{ typeof(JsonTypePlaceholder), _jsonbOwned },
{ typeof(char), _singleChar },
{ typeof(DateTime), LegacyTimestampBehavior ? _timestamp : _timestamptz },
{ typeof(DateOnly), _dateDateOnly },
Expand Down
4 changes: 2 additions & 2 deletions test/EFCore.PG.FunctionalTests/LazyLoadProxyNpgsqlTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Microsoft.EntityFrameworkCore;

// ReSharper disable once UnusedMember.Global
public class LazyLoadProxyNpgsqlTest : LazyLoadProxyTestBase<LazyLoadProxyNpgsqlTest.LoadNpgsqlFixture>
public class LazyLoadProxyNpgsqlTest : LazyLoadProxyRelationalTestBase<LazyLoadProxyNpgsqlTest.LoadNpgsqlFixture>
{
public LazyLoadProxyNpgsqlTest(LoadNpgsqlFixture fixture)
: base(fixture)
Expand Down Expand Up @@ -1491,7 +1491,7 @@ protected override string SerializedBlogs1

#endregion Expected JSON override

public class LoadNpgsqlFixture : LoadFixtureBase
public class LoadNpgsqlFixture : LoadRelationalFixtureBase
{
public TestSqlLoggerFactory TestSqlLoggerFactory
=> (TestSqlLoggerFactory)ServiceProvider.GetRequiredService<ILoggerFactory>();
Expand Down
42 changes: 33 additions & 9 deletions test/EFCore.PG.FunctionalTests/Query/AdHocJsonQueryNpgsqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Microsoft.EntityFrameworkCore.Query;

#nullable disable

public class AdHocJsonQueryNpgsqlTest : AdHocJsonQueryTestBase
public class AdHocJsonQueryNpgsqlTest : AdHocJsonQueryRelationalTestBase
{
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;
Expand Down Expand Up @@ -296,7 +296,7 @@ public class TypesJsonEntity
public TimeSpan Interval { get; set; }
}

#region 34960
#region Problematc tests (Unspecified DateTime)

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

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

#endregion 34960

#region 34293

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

public override Task Project_entity_with_optional_json_entity_owned_by_required_json()
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_entity_with_optional_json_entity_owned_by_required_json());

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

#endregion 34293
public override Task Project_missing_required_scalar(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_missing_required_scalar(async));

public override Task Project_nested_json_entity_with_missing_scalars(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_nested_json_entity_with_missing_scalars(async));

public override Task Project_null_required_scalar(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_null_required_scalar(async));

public override Task Project_root_entity_with_missing_required_navigation(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_entity_with_missing_required_navigation(async));

public override Task Project_root_entity_with_null_required_navigation(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_entity_with_null_required_navigation(async));

public override Task Project_root_with_missing_scalars(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_root_with_missing_scalars(async));

public override Task Project_top_level_json_entity_with_missing_scalars(bool async)
=> Assert.ThrowsAsync<ArgumentException>(() => base.Project_top_level_json_entity_with_missing_scalars(async));

public override Task Project_missing_required_navigation(bool async)
=> Task.CompletedTask; // Different exception expected in the base implementation

public override Task Project_null_required_navigation(bool async)
=> Task.CompletedTask; // Different exception expected in the base implementation

public override Task Project_top_level_entity_with_null_value_required_scalars(bool async)
=> Task.CompletedTask; // Different exception expected in the base implementation

#endregion Problematc tests (Unspecified DateTime)

protected void AssertSql(params string[] expected)
=> TestSqlLoggerFactory.AssertBaseline(expected);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;

namespace Microsoft.EntityFrameworkCore.Query;

public class AdHocMiscellaneousQueryNpgsqlTest : AdHocMiscellaneousQueryRelationalTestBase
{
protected override ITestStoreFactory TestStoreFactory
=> NpgsqlTestStoreFactory.Instance;

protected override DbContextOptionsBuilder SetTranslateParameterizedCollectionsToConstants(DbContextOptionsBuilder optionsBuilder)
{
new NpgsqlDbContextOptionsBuilder(optionsBuilder).TranslateParameterizedCollectionsToConstants();

return optionsBuilder;
}

// Unlike the other providers, EFCore.PG does actually support mapping JsonElement
public override Task Mapping_JsonElement_property_throws_a_meaningful_exception()
=> Task.CompletedTask;

protected override Task Seed2951(Context2951 context)
=> context.Database.ExecuteSqlRawAsync(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task Array_contains_is_not_parameterized_with_array_on_redshift()
"""
SELECT t."Id", t."SomeInt"
FROM "TestEntities" AS t
WHERE t."SomeInt" IN (8, 9)
WHERE t."SomeInt" IN (?, ?)
LIMIT 2
""");
}
Expand Down
Loading