Skip to content

Commit 37b52bc

Browse files
authored
Es/r4 postgres (#143)
* CoreEx.Database.Postgres project introduction. * Refactor Products sample to leverage PostgreSQL. * Update to use interim schema for dbex yaml. * Generator fixes. Packaging improvements. * DbEx finalized version. Minor solution tweaks. * Orders merge, and refactor/regen. E2E testing uplift. * CI.yml added. * Fix CI.yml * Add slnf files to aid CI. * Further tweaks to CI and test fix. * CI fix. * Split parrallel and sequential for core to improve perf. * Test fixes. * Add retry to CircuitBreaker test. * Fix parallelism for samples. * Another parallelism fix. * Another parallelism fix attemp?! * Another parallelism crack :-( * Fix async bug. * NUnit result fix for retry. * Another CI fix. * Fixes related to PR comments. * Re-gen sql procs. * Tweaks based on review. * Puch CI tweak. * Another CI tweak. * Sneak last - link to DTS from Aspire dashboard. * Wrap up tweaks. * CI tweak. * Review feedback tweaks.
1 parent b151a31 commit 37b52bc

241 files changed

Lines changed: 4648 additions & 1932 deletions

File tree

Some content is hidden

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

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-reportgenerator-globaltool": {
6+
"version": "5.5.10",
7+
"commands": [
8+
"reportgenerator"
9+
]
10+
}
11+
}
12+
}

.github/copilot-instructions.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CoreEx is a modular .NET framework for enterprise APIs and distributed services.
3737
### CoreEx-First Patterns
3838
- Prefer CoreEx primitives before introducing external libraries that overlap with framework capabilities.
3939
- Prefer CoreEx exception types (`NotFoundException`, `ValidationException`, `BusinessException`, `ConcurrencyException`, etc.) and CoreEx `Result`/`Result<T>` flows over custom error wrappers.
40-
- Do not introduce AutoMapper unless the user explicitly requests it. Repositories and services use explicit mapping helpers/classes.
40+
- Do not introduce AutoMapper in any repository unless the repository maintainer explicitly requests it. Repositories and services use explicit mapping helpers/classes.
4141

4242
### Contracts and Source Generation
4343
- Contracts are commonly declared as `[Contract] public partial class ...`.
@@ -97,6 +97,12 @@ CoreEx is a modular .NET framework for enterprise APIs and distributed services.
9797
- Use `GlobalUsing.cs` per project; do not scatter `using` directives.
9898
- Always use `.ConfigureAwait(false)` in service/repository code.
9999

100+
### Generated Code
101+
- Do not edit generated code directly. If changes are needed, update the source templates or generation logic.
102+
- Generated code files are typically marked with a comment at the top indicating they are auto-generated and should not be edited manually.
103+
- Generated code also has the file name pattern `*.g.cs`, `*.g.sql`, `*.g.pgsql` or similar to indicate its nature.
104+
- Copilot should not suggest edits to generated code files. If it does, the suggestion should be rejected or redirected to the source templates.
105+
100106
## Key Docs to Read Before Large Changes
101107
- `README.md` for repo-level positioning and top-level commands.
102108
- `samples\README.md` for the runnable Contoso architecture and local setup.
@@ -119,7 +125,7 @@ The following prompts and skills are available in this repository. Type `/` in c
119125

120126
When creating or maintaining Copilot instruction files and skills:
121127

122-
- **Instruction files** (`.instructions.md`) — see [INSTRUCTION_AUTHORING.md](.github/INSTRUCTION_AUTHORING.md) for standards on YAML frontmatter, section order, and content rules.
123-
- **Skill files** (`SKILL.md`) — see [SKILL_AUTHORING.md](.github/SKILL_AUTHORING.md) for the directory structure pattern (`references/`, `assets/`), lean main file rules (<300 lines), and cross-referencing guidelines.
128+
- **Instruction files** (`.instructions.md`) — see [INSTRUCTION_AUTHORING.md](./INSTRUCTION_AUTHORING.md) for standards on YAML frontmatter, section order, and content rules.
129+
- **Skill files** (`SKILL.md`) — see [SKILL_AUTHORING.md](./SKILL_AUTHORING.md) for the directory structure pattern (`references/`, `assets/`), lean main file rules (<300 lines), and cross-referencing guidelines.
124130

125131
Both documents define durable patterns for creating guidance that is discoverable, maintainable, and context-efficient.

.github/workflows/CI.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'src/**'
8+
- 'tests/**'
9+
- 'samples/**'
10+
- 'gen/**'
11+
- 'servicebus/**'
12+
- 'Directory.Packages.props'
13+
- 'docker-compose.yml'
14+
- '*.slnf'
15+
- '*.sln'
16+
- '.config/dotnet-tools.json'
17+
- '.github/workflows/CI.yml'
18+
pull_request:
19+
paths:
20+
- 'src/**'
21+
- 'tests/**'
22+
- 'samples/**'
23+
- 'gen/**'
24+
- 'servicebus/**'
25+
- 'Directory.Packages.props'
26+
- 'docker-compose.yml'
27+
- '*.slnf'
28+
- '*.sln'
29+
- '.config/dotnet-tools.json'
30+
- '.github/workflows/CI.yml'
31+
workflow_dispatch:
32+
33+
concurrency:
34+
group: ci-${{ github.workflow }}-${{ github.ref }}
35+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
36+
37+
permissions:
38+
contents: read
39+
40+
jobs:
41+
build:
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 60
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Start containers
49+
run: docker compose up -d
50+
51+
- name: Setup .NET
52+
uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: |
55+
8.x
56+
9.x
57+
10.x
58+
59+
- name: Cache NuGet packages
60+
uses: actions/cache@v4
61+
with:
62+
path: ~/.nuget/packages
63+
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
64+
restore-keys: nuget-${{ runner.os }}-
65+
66+
- name: Restore .NET tools
67+
run: dotnet tool restore
68+
69+
- name: Restore (all)
70+
run: dotnet restore CoreEx.sln --verbosity minimal
71+
72+
# --- Core ---
73+
74+
- name: Build core
75+
run: dotnet build CoreEx.Core.slnf --no-restore --configuration Release
76+
77+
- name: Test core (parallel)
78+
run: dotnet test CoreEx.Core.Test.Parallel.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/core
79+
80+
- name: Test core (sequential)
81+
run: dotnet test CoreEx.Core.Test.Sequential.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/core -m:1 -p:TestTfmsInParallel=false -p:BuildInParallel=false
82+
83+
- name: Upload core test results
84+
if: always()
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: core-test-results
88+
path: "coverage/core/**/*.trx"
89+
retention-days: 30
90+
91+
# --- Samples ---
92+
93+
- name: Build samples
94+
run: dotnet build CoreEx.Samples.Build.slnf --no-restore --configuration Release
95+
96+
- name: Database tool (samples/src/Contoso.Products.Database)
97+
working-directory: samples/src/Contoso.Products.Database
98+
run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes
99+
100+
- name: Database tool (samples/src/Contoso.Shopping.Database)
101+
working-directory: samples/src/Contoso.Shopping.Database
102+
run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes
103+
104+
- name: Database tool (samples/src/Contoso.Orders.Database)
105+
working-directory: samples/src/Contoso.Orders.Database
106+
run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes
107+
108+
- name: Test samples
109+
run: dotnet test CoreEx.Samples.Test.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/samples -m:1 -p:TestTfmsInParallel=false -p:BuildInParallel=false
110+
111+
- name: Upload samples test results
112+
if: always()
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: samples-test-results
116+
path: "coverage/samples/**/*.trx"
117+
retention-days: 30
118+
119+
# --- Coverage ---
120+
121+
- name: Merge and generate coverage report
122+
if: always()
123+
run: |
124+
dotnet tool run reportgenerator \
125+
-reports:"coverage/**/coverage.cobertura.xml" \
126+
-targetdir:"coverage/report" \
127+
-reporttypes:"HtmlInline_AzurePipelines;Cobertura;Badges" \
128+
-assemblyfilters:"-*Test*;-*E2E*"
129+
130+
- name: Upload coverage report
131+
if: always()
132+
uses: actions/upload-artifact@v4
133+
with:
134+
name: coverage-report
135+
path: coverage/report
136+
retention-days: 30
137+
138+
# --- Cleanup ---
139+
140+
- name: Capture container logs on failure
141+
if: failure()
142+
run: docker compose logs --no-color > container-logs.txt 2>&1
143+
144+
- name: Upload container logs on failure
145+
if: failure()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: container-logs
149+
path: container-logs.txt
150+
retention-days: 30
151+
152+
- name: Stop containers
153+
if: always()
154+
run: docker compose down

CoreEx.Core.Test.Parallel.slnf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"solution": {
3+
"path": "CoreEx.sln",
4+
"projects": [
5+
"tests/CoreEx.Test.Unit/CoreEx.Test.Unit.csproj",
6+
"tests/CoreEx.AspNetCore.Test.Unit/CoreEx.AspNetCore.Test.Unit.csproj",
7+
"tests/CoreEx.Data.Test.Unit/CoreEx.Data.Test.Unit.csproj",
8+
"tests/CoreEx.Database.Test.Unit/CoreEx.Database.Test.Unit.csproj",
9+
"tests/CoreEx.DomainDriven.Test.Unit/CoreEx.DomainDriven.Test.Unit.csproj",
10+
"tests/CoreEx.Events.Test.Unit/CoreEx.Events.Test.Unit.csproj",
11+
"tests/CoreEx.RefData.Test.Unit/CoreEx.RefData.Test.Unit.csproj",
12+
"tests/CoreEx.Validation.Test.Unit/CoreEx.Validation.Test.Unit.csproj"
13+
]
14+
}
15+
}

CoreEx.Core.Test.Sequential.slnf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"solution": {
3+
"path": "CoreEx.sln",
4+
"projects": [
5+
"tests/CoreEx.Azure.Messaging.ServiceBus.Test.Unit/CoreEx.Azure.Messaging.ServiceBus.Test.Unit.csproj",
6+
"tests/CoreEx.Caching.Redis.Test.Unit/CoreEx.Caching.Redis.Test.Unit.csproj",
7+
"tests/CoreEx.Database.SqlServer.Test.Unit/CoreEx.Database.SqlServer.Test.Unit.csproj",
8+
"tests/CoreEx.Database.Postgres.Test.Unit/CoreEx.Database.Postgres.Test.Unit.csproj"
9+
]
10+
}
11+
}

CoreEx.Core.slnf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"solution": {
3+
"path": "CoreEx.sln",
4+
"projects": [
5+
"src/CoreEx/CoreEx.csproj",
6+
"src/CoreEx.AspNetCore/CoreEx.AspNetCore.csproj",
7+
"src/CoreEx.AspNetCore.NSwag/CoreEx.AspNetCore.NSwag.csproj",
8+
"src/CoreEx.Azure.Messaging.ServiceBus/CoreEx.Azure.Messaging.ServiceBus.csproj",
9+
"src/CoreEx.Caching.FusionCache/CoreEx.Caching.FusionCache.csproj",
10+
"src/CoreEx.Data/CoreEx.Data.csproj",
11+
"src/CoreEx.Database/CoreEx.Database.csproj",
12+
"src/CoreEx.Database.Postgres/CoreEx.Database.Postgres.csproj",
13+
"src/CoreEx.Database.SqlServer/CoreEx.Database.SqlServer.csproj",
14+
"src/CoreEx.DomainDriven/CoreEx.DomainDriven.csproj",
15+
"src/CoreEx.EntityFrameworkCore/CoreEx.EntityFrameworkCore.csproj",
16+
"src/CoreEx.Events/CoreEx.Events.csproj",
17+
"src/CoreEx.RefData/CoreEx.RefData.csproj",
18+
"src/CoreEx.UnitTesting/CoreEx.UnitTesting.csproj",
19+
"src/CoreEx.Validation/CoreEx.Validation.csproj",
20+
"tests/CoreEx.AspNetCore.Test.Api/CoreEx.AspNetCore.Test.Api.csproj",
21+
"tests/CoreEx.AspNetCore.Test.Unit/CoreEx.AspNetCore.Test.Unit.csproj",
22+
"tests/CoreEx.Azure.Messaging.ServiceBus.Test.Unit/CoreEx.Azure.Messaging.ServiceBus.Test.Unit.csproj",
23+
"tests/CoreEx.Caching.Redis.Test.Unit/CoreEx.Caching.Redis.Test.Unit.csproj",
24+
"tests/CoreEx.Data.Test.Unit/CoreEx.Data.Test.Unit.csproj",
25+
"tests/CoreEx.Database.Postgres.Test.Unit/CoreEx.Database.Postgres.Test.Unit.csproj",
26+
"tests/CoreEx.Database.SqlServer.Test.Unit/CoreEx.Database.SqlServer.Test.Unit.csproj",
27+
"tests/CoreEx.Database.Test.Unit/CoreEx.Database.Test.Unit.csproj",
28+
"tests/CoreEx.DomainDriven.Test.Unit/CoreEx.DomainDriven.Test.Unit.csproj",
29+
"tests/CoreEx.Events.Test.Unit/CoreEx.Events.Test.Unit.csproj",
30+
"tests/CoreEx.RefData.Test.Unit/CoreEx.RefData.Test.Unit.csproj",
31+
"tests/CoreEx.Test.Unit/CoreEx.Test.Unit.csproj",
32+
"tests/CoreEx.Validation.Test.Unit/CoreEx.Validation.Test.Unit.csproj"
33+
]
34+
}
35+
}

CoreEx.Samples.Build.slnf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"solution": {
3+
"path": "CoreEx.sln",
4+
"projects": [
5+
"samples/aspire/Contoso.Aspire/Contoso.Aspire.csproj",
6+
"samples/src/Contoso.Order.Workflow.Client/Contoso.Order.Workflow.Client.csproj",
7+
"samples/src/Contoso.Order.Workflow.Worker/Contoso.Order.Workflow.Worker.csproj",
8+
"samples/src/Contoso.Order.Workflow.Workflow/Contoso.Order.Workflow.Workflow.csproj",
9+
"samples/src/Contoso.Orders.Api/Contoso.Orders.Api.csproj",
10+
"samples/src/Contoso.Orders.Application/Contoso.Orders.Application.csproj",
11+
"samples/src/Contoso.Orders.Contracts/Contoso.Orders.Contracts.csproj",
12+
"samples/src/Contoso.Orders.Database/Contoso.Orders.Database.csproj",
13+
"samples/src/Contoso.Orders.Infrastructure/Contoso.Orders.Infrastructure.csproj",
14+
"samples/src/Contoso.Products.Api/Contoso.Products.Api.csproj",
15+
"samples/src/Contoso.Products.Application/Contoso.Products.Application.csproj",
16+
"samples/src/Contoso.Products.Contracts/Contoso.Products.Contracts.csproj",
17+
"samples/src/Contoso.Products.Database/Contoso.Products.Database.csproj",
18+
"samples/src/Contoso.Products.Infrastructure/Contoso.Products.Infrastructure.csproj",
19+
"samples/src/Contoso.Products.Outbox.Relay/Contoso.Products.Outbox.Relay.csproj",
20+
"samples/src/Contoso.Products.Subscribe/Contoso.Products.Subscribe.csproj",
21+
"samples/src/Contoso.Shopping.Api/Contoso.Shopping.Api.csproj",
22+
"samples/src/Contoso.Shopping.Application/Contoso.Shopping.Application.csproj",
23+
"samples/src/Contoso.Shopping.Contracts/Contoso.Shopping.Contracts.csproj",
24+
"samples/src/Contoso.Shopping.Database/Contoso.Shopping.Database.csproj",
25+
"samples/src/Contoso.Shopping.Domain/Contoso.Shopping.Domain.csproj",
26+
"samples/src/Contoso.Shopping.Infrastructure/Contoso.Shopping.Infrastructure.csproj",
27+
"samples/src/Contoso.Shopping.Outbox.Relay/Contoso.Shopping.Outbox.Relay.csproj",
28+
"samples/src/Contoso.Shopping.Subscribe/Contoso.Shopping.Subscribe.csproj",
29+
"samples/tests/Contoso.E2E.Runner/Contoso.E2E.Runner.csproj",
30+
"samples/tests/Contoso.Orders.Test.Api/Contoso.Orders.Test.Api.csproj",
31+
"samples/tests/Contoso.Orders.Test.Common/Contoso.Orders.Test.Common.csproj",
32+
"samples/tests/Contoso.Orders.Test.Unit/Contoso.Orders.Test.Unit.csproj",
33+
"samples/tests/Contoso.Products.Test.Api/Contoso.Products.Test.Api.csproj",
34+
"samples/tests/Contoso.Products.Test.Common/Contoso.Products.Test.Common.csproj",
35+
"samples/tests/Contoso.Products.Test.Outbox.Relay/Contoso.Products.Test.Outbox.Relay.csproj",
36+
"samples/tests/Contoso.Products.Test.Subscribe/Contoso.Products.Test.Subscribe.csproj",
37+
"samples/tests/Contoso.Products.Test.Unit/Contoso.Products.Test.Unit.csproj",
38+
"samples/tests/Contoso.Shopping.Test.Api/Contoso.Shopping.Test.Api.csproj",
39+
"samples/tests/Contoso.Shopping.Test.Common/Contoso.Shopping.Test.Common.csproj"
40+
]
41+
}
42+
}

CoreEx.Samples.Test.slnf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"solution": {
3+
"path": "CoreEx.sln",
4+
"projects": [
5+
"samples/tests/Contoso.Orders.Test.Api/Contoso.Orders.Test.Api.csproj",
6+
"samples/tests/Contoso.Orders.Test.Unit/Contoso.Orders.Test.Unit.csproj",
7+
"samples/tests/Contoso.Products.Test.Api/Contoso.Products.Test.Api.csproj",
8+
"samples/tests/Contoso.Products.Test.Outbox.Relay/Contoso.Products.Test.Outbox.Relay.csproj",
9+
"samples/tests/Contoso.Products.Test.Subscribe/Contoso.Products.Test.Subscribe.csproj",
10+
"samples/tests/Contoso.Products.Test.Unit/Contoso.Products.Test.Unit.csproj",
11+
"samples/tests/Contoso.Shopping.Test.Api/Contoso.Shopping.Test.Api.csproj"
12+
]
13+
}
14+
}

0 commit comments

Comments
 (0)