Skip to content

Commit 630d9a4

Browse files
committed
use NpgsqlSqlNullabilityProcessor
1 parent 8875985 commit 630d9a4

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/Thinktecture.EntityFrameworkCore.PostgreSQL/EntityFrameworkCore/Query/ThinktectureNpgsqlSqlNullabilityProcessor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
using System.Diagnostics.CodeAnalysis;
22
using Microsoft.EntityFrameworkCore.Query;
33
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
4+
using Npgsql.EntityFrameworkCore.PostgreSQL.Query.Internal;
45
using Thinktecture.EntityFrameworkCore.Query.SqlExpressions;
56

67
namespace Thinktecture.EntityFrameworkCore.Query;
78

89
/// <summary>
9-
/// Extends <see cref="SqlNullabilityProcessor"/> to support Thinktecture extensions.
10+
/// Extends <see cref="NpgsqlSqlNullabilityProcessor"/> to support Thinktecture extensions.
1011
/// </summary>
1112
[SuppressMessage("Usage", "EF1001", MessageId = "Internal EF Core API usage.")]
12-
public class ThinktectureNpgsqlSqlNullabilityProcessor : SqlNullabilityProcessor
13+
public class ThinktectureNpgsqlSqlNullabilityProcessor : NpgsqlSqlNullabilityProcessor
1314
{
1415
/// <inheritdoc />
1516
public ThinktectureNpgsqlSqlNullabilityProcessor(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Thinktecture.TestDatabaseContext;
2+
3+
namespace Thinktecture.EntityFrameworkCore.Query;
4+
5+
public class ThinktectureNpgsqlSqlNullabilityProcessorTests : IntegrationTestsBase
6+
{
7+
public ThinktectureNpgsqlSqlNullabilityProcessorTests(ITestOutputHelper testOutputHelper, NpgsqlFixture npgsqlFixture)
8+
: base(testOutputHelper, npgsqlFixture)
9+
{
10+
}
11+
12+
[Fact]
13+
public async Task Should_handle_HashSet_Contains_translated_to_PgAnyExpression()
14+
{
15+
var entityId = new Guid("4883F7E0-FC8C-45FF-A579-DF351A3E79BA");
16+
ArrangeDbContext.TestEntities.Add(new TestEntity { Id = entityId, Name = "Test", RequiredName = "RequiredName", Count = 1 });
17+
await ArrangeDbContext.SaveChangesAsync();
18+
19+
var ids = new HashSet<Guid> { entityId };
20+
21+
var result = await ActDbContext.TestEntities
22+
.Where(e => ids.Contains(e.Id))
23+
.ToListAsync();
24+
25+
result.Should().HaveCount(1);
26+
result[0].Id.Should().Be(entityId);
27+
}
28+
}

0 commit comments

Comments
 (0)