Skip to content

Result Pattern sample: port to .NET 10 minimal APIs and the Clean Architecture Result design - #2240

Merged
vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116672-aspnetcore-result-pattern
Oct 1, 2026
Merged

vladimir-pecanac-main merged 3 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116672-aspnetcore-result-pattern

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Ports aspnetcore-webapi/UsingResultPatternInNETWebAPI in place for the updated article "Result Pattern in C# and .NET Web API" (https://code-maze.com/aspnetcore-result-pattern/). Same folder, same project names, same five iterations.

  • net10.0, minimal API endpoints v1 to v5 on the same routes (api/v1/contacts to api/v5/contacts)
  • TheResultPattern: Result and Result<TValue> with implicit conversions, Error(Code, Description, Type), ErrorType, ContactErrors, and ToProblem() mapping errors to problem details (404 and 409)
  • A duplicate email is now a Conflict (409) instead of a validation error
  • ConflictException, and a DefaultExceptionHandler that writes problem details
  • FluentResults 4.0.0 with RecordNotFoundError and ConflictError
  • Tests: 47 (four service test classes and one endpoint class covering every version's status codes), none named Live

Local run: dotnet build -c Release, 0 warnings, 0 errors; dotnet test, 47 of 47 passed.

…hitecture Result design

Ports aspnetcore-webapi/UsingResultPatternInNETWebAPI in place for the updated article
"Result Pattern in C# and .NET Web API" (https://code-maze.com/aspnetcore-result-pattern/).

- net10.0, minimal API endpoints v1 to v5 on the same routes (api/v1/contacts to api/v5/contacts)
- TheResultPattern: Result and Result<TValue> with implicit conversions, Error(Code, Description, Type),
  ErrorType, ContactErrors and ToProblem() mapping to problem details (404 and 409)
- A duplicate email is now a Conflict (409) instead of a validation error
- Exceptions: ConflictException, and a DefaultExceptionHandler that writes problem details
- FluentResults 4.0.0 with RecordNotFoundError and ConflictError
- Tests: 47 tests (four service classes and one endpoint class covering every version's status codes)

Local run: dotnet build -c Release, 0 warnings, 0 errors; dotnet test, 47 of 47 passed.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit f28871c into CodeMazeBlog:main Oct 1, 2026
4 checks passed
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.

1 participant