Skip to content

Es/r4 postgres#143

Merged
chullybun merged 31 commits into
release/4from
es/r4-postgres
May 18, 2026
Merged

Es/r4 postgres#143
chullybun merged 31 commits into
release/4from
es/r4-postgres

Conversation

@chullybun

Copy link
Copy Markdown
Collaborator
  • Introduce PostgreSQL
  • Merge others and confirm
  • Introduce CI

Copilot AI review requested due to automatic review settings May 13, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces PostgreSQL support into CoreEx and migrates the Contoso Products sample from SQL Server to PostgreSQL, while also updating packaging, source generation, test setup, and solution filters for CI/build workflows.

Changes:

  • Added PostgreSQL database, unit-of-work, outbox publisher/relay, OpenTelemetry, and unit-test infrastructure.
  • Migrated Contoso Products database, infrastructure, hosts, and tests to PostgreSQL.
  • Updated packaging/signing/source-generator setup and added solution filters for core/sample build and test execution.

Reviewed changes

Copilot reviewed 229 out of 232 changed files in this pull request and generated 36 comments.

Show a summary per file
File Description
src/CoreEx.Database.Postgres/* Adds PostgreSQL database, outbox, unit-of-work, DI, telemetry, metrics, and parameter support.
samples/src/Contoso.Products.* Migrates Products API, Subscribe, Outbox Relay, Database, and Infrastructure to PostgreSQL.
samples/tests/Contoso.Products.* Updates Products tests to use PostgreSQL migrations and outbox expectations.
tests/CoreEx.Database.Postgres.* Adds PostgreSQL database and EF CRUD/query/unit-of-work test coverage.
src/CoreEx.Database/* Refactors database abstractions, parameters, scalar handling, outbox base behavior, and database columns.
src/CoreEx.Database.SqlServer/* Adapts SQL Server implementation to new database abstractions and outbox publisher location.
src/CoreEx.EntityFrameworkCore/Converters/* Renames/removes EF converters and adds a JsonElement EF converter.
src/CoreEx.UnitTesting/* Adds PostgreSQL test helpers and refactors migration helper state.
src/CoreEx/* Adds precision time provider, DI registration, strong-name/internal updates, and uint ETag converter.
gen/CoreEx.Generator/* Updates generator packaging/signing and fixes template/source-generation behavior.
Directory.Packages.props Adds PostgreSQL/Npgsql/DbEx package versions and generator signing dependency.
src/Directory.Build.props Centralizes versioning, package metadata, signing, source/symbol packaging, and assets.
src/CoreEx/CoreEx.csproj Bundles the source generator and analyzer dependencies into the CoreEx package.
samples/src/Contoso.Orders.* Regenerates Orders persistence models and adjusts mapping/repository nullability.
samples/src/Contoso.Shopping.* Adds precision time provider and SQL Server EF connection ownership changes.
samples/tests/Contoso.E2E.Runner/* Updates Products migration to PostgreSQL and adds Orders API status/configuration.
tests/CoreEx.Azure.Messaging.ServiceBus.Test.Unit/* Adjusts Service Bus cleanup timing and circuit-breaker test retry behavior.
tests/CoreEx.Caching.Redis.Test.Unit/* Updates cache log expectation and disables TFM-parallel execution.
tests/CoreEx.Database.SqlServer.Test.Unit/* Updates SQL Server tests for connection ownership/converters and sequential TFM execution.
tests/CoreEx.Validation.Test.Unit/ValidatorTests.cs Makes currency-format validation culture-stable.
tests/CoreEx.RefData.Test.Unit/ReferenceDataOrchestratorTests.cs Adds a reference-data code collection source-generation test type.
samples/aspire/Contoso.Aspire/AppHost.cs Reorganizes sample Aspire host declarations.
CoreEx.*.slnf Adds solution filters for core/sample build and test workflows.
.config/dotnet-tools.json Adds report generator local tool manifest.
nuget-publish.ps1 Updates package publish project list.
Comments suppressed due to low confidence (7)

src/CoreEx.UnitTesting/UnitTestExExtensions.Postgres.cs:52

  • Typo in the remarks: “isued” should be “issued”.
    src/CoreEx.UnitTesting/UnitTestExExtensions.SqlServer.cs:52
  • Typo in the remarks: “isued” should be “issued”.
    samples/src/Contoso.Products.Outbox.Relay/Contoso.Products.Outbox.Relay.http:8
  • The hosted-service key is registered as postgres-outbox-relay-00, but this sample request uses Postgres-outbox-relay-00. Use the registered lowercase key so the copied request targets the actual hosted service.
    samples/src/Contoso.Products.Outbox.Relay/Contoso.Products.Outbox.Relay.http:12
  • The hosted-service key is registered as postgres-outbox-relay-00, but this sample request uses Postgres-outbox-relay-00. Use the registered lowercase key so the copied request targets the actual hosted service.
    samples/src/Contoso.Products.Database/Migrations/20260101-000301-create-products-outbox-tables.pgsql:29
  • The column is declared NOT NULL and the lease functions use '(none)' for non-tenant events, so the comment saying “null indicates no tenancy” is inaccurate. Update it to describe the actual sentinel value.
    src/CoreEx.EntityFrameworkCore/Converters/StringBase64Converter.cs:1
  • Removing this public EF converter is a source-breaking change for consumers that reference CoreEx.EntityFrameworkCore.Converters.StringBase64Converter directly. If the replacement is ValueConverterBridge.Create(...StringBase64Converter.Default), keep a compatibility shim or document the breaking API change.
    src/CoreEx.EntityFrameworkCore/Converters/JsonElementStringConverter.cs:1
  • Renaming/removing this public converter breaks consumers that reference CoreEx.EntityFrameworkCore.Converters.JsonElementStringConverter directly. Consider keeping a forwarding compatibility type that derives from the new JsonElementStringEfConverter, or document the breaking API change.

Comment thread src/CoreEx.Database/DatabaseCommand.Scalar.cs
Comment thread gen/CoreEx.Generator/CoreEx.Generator.csproj Outdated
Comment thread src/CoreEx.UnitTesting/UnitTestExExtensions.Postgres.cs Outdated
Comment thread src/CoreEx.UnitTesting/UnitTestExExtensions.Postgres.cs Outdated
Comment thread src/CoreEx.UnitTesting/UnitTestExExtensions.SqlServer.cs Outdated
Comment thread src/CoreEx.Database.Postgres/Outbox/PostgresOutboxPublisher.cs
Comment thread samples/tests/Contoso.Products.Test.Unit/EntryPoint.cs
Comment thread src/CoreEx.Database.Postgres/Outbox/PostgresOutboxRelay.cs
Copilot AI review requested due to automatic review settings May 14, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 236 out of 239 changed files in this pull request and generated 33 comments.

Comments suppressed due to low confidence (2)

src/CoreEx.EntityFrameworkCore/Converters/StringBase64Converter.cs:1

  • Deleting this public EF converter removes CoreEx.EntityFrameworkCore.Converters.StringBase64Converter from the package, which will break consumers mapping row-version/ETag properties with the existing type. Consider keeping it as an obsolete wrapper around ValueConverterBridge for source compatibility.
    samples/src/Contoso.Orders.Database/Schema/Stored Procedures/spOutboxBatchComplete.g.sql:54
  • @TenantId and @PartitionId are assigned from @Completed but never used afterward. This adds unnecessary work and makes the procedure look like the values affect lease release when they do not.
    -- 2) Capture tenant/partition from first completed row.
    SELECT TOP 1
      @TenantId = TenantId,
      @PartitionId = PartitionId
    FROM @Completed;

Comment thread src/CoreEx.Database/SqlStatement.cs Outdated
Comment thread src/CoreEx.Database/DatabaseCommand.cs Outdated
Comment thread src/CoreEx.Database/SqlStatement.cs
Comment thread src/CoreEx.UnitTesting/Data/JsonDataReaderArgs.cs
Comment thread src/CoreEx/CoreEx.csproj Outdated
Comment thread src/CoreEx.Database/IDatabase.cs
Comment thread src/CoreEx.Database/Extended/DatabaseColumns.cs
Copilot AI review requested due to automatic review settings May 14, 2026 22:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 237 out of 240 changed files in this pull request and generated 14 comments.

Comments suppressed due to low confidence (2)

src/CoreEx.EntityFrameworkCore/Converters/StringBase64Converter.cs:1

  • Removing this public converter type is a source-breaking change for any consumer that configures EF mappings with CoreEx.EntityFrameworkCore.Converters.StringBase64Converter.Default. Keep a compatibility wrapper (possibly obsolete) or document and coordinate the breaking API change.
    src/CoreEx.EntityFrameworkCore/Converters/JsonElementStringConverter.cs:1
  • This removes the existing public JsonElementStringConverter API and replaces it with a differently named type, which will break consumers that already reference the old EF converter in their model configuration. Consider leaving an obsolete wrapper that derives from/forwards to JsonElementStringEfConverter to preserve source compatibility.

Comment thread src/CoreEx.Database/DatabaseCommand.Scalar.cs
Comment thread tests/CoreEx.RefData.Test.Unit/ReferenceDataOrchestratorTests.cs
Comment thread src/CoreEx.Database/SqlStatement.cs Outdated
Comment on lines 20 to +23
string[] _requiredServices =
[
"sqlServer",
"sqlserver-outbox-relay-00",
"sqlserver-outbox-relay-01",
"sqlserver-outbox-relay-02",
"sqlserver-outbox-relay-03"
"postgres",
"postgres-outbox-relay-00",
Comment thread src/CoreEx.Database/SqlStatement.cs
Comment thread samples/tests/Contoso.E2E.Runner/Program.cs
Comment on lines +15 to +19
public sealed class PrecisionTimeProvider(int decimalPlaces = 6, TimeProvider? innerProvider = null) : TimeProvider
{
private readonly TimeProvider _innerProvider = innerProvider ?? System;
private readonly int _decimalPlaces = decimalPlaces >= 0 && decimalPlaces <= 7 ? decimalPlaces : throw new ArgumentOutOfRangeException(nameof(decimalPlaces), "Must be between 0 and 7.");
private readonly long _tickDivisor = (long)Math.Pow(10, 7 - decimalPlaces);
Comment on lines +6 to +9
public readonly struct EncodedStringToUInt32Converter : IConverter<string?, uint>
{
private static readonly ValueConverter<string?, uint> _convertToDestination = new(s => s == null ? 0 : BitConverter.ToUInt32(Convert.FromBase64String(s)));
private static readonly ValueConverter<uint, string?> _convertToSource = new(d => d == 0 ? null : Convert.ToBase64String(BitConverter.GetBytes(d)));
Comment thread src/CoreEx.UnitTesting/Data/JsonDataReaderArgs.cs
Copilot AI review requested due to automatic review settings May 15, 2026 20:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 237 out of 240 changed files in this pull request and generated 9 comments.

Comments suppressed due to low confidence (2)

tests/CoreEx.Database.Postgres.Test.Console/Data/data.yaml:12

  • This row also seeds the PostgreSQL boolean is_deleted column with numeric 1. Use the boolean literal true to avoid type errors during PostgreSQL data loading.
    src/CoreEx.Database/SqlStatement.cs:62
  • This XML comment also refers to SqlStatement as a struct after the type was changed to a class; update it so generated API docs match the implementation.

Comment thread src/CoreEx.UnitTesting/UnitTestExExtensions.cs Outdated
Comment thread src/CoreEx.Database/Database.cs Outdated
Comment thread src/CoreEx.Database/SqlStatement.cs Outdated
Comment thread tests/CoreEx.Database.Postgres.Test.Console/Data/data.yaml
Comment thread tests/CoreEx.Database.Postgres.Test.Unit/EntityFrameworkCrudTests.Get.cs Outdated
Comment thread .github/workflows/CI.yml
Comment thread .github/workflows/CI.yml
Copilot AI review requested due to automatic review settings May 18, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@chullybun chullybun merged commit 37b52bc into release/4 May 18, 2026
4 of 5 checks passed
@chullybun chullybun deleted the es/r4-postgres branch May 18, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants