-
Notifications
You must be signed in to change notification settings - Fork 282
refactor(samples): modernise CommandProcessor samples #3998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
holytshirt
commented
Jan 31, 2026
- Use Host.CreateApplicationBuilder() instead of CreateDefaultBuilder()
- Replace GetService with GetRequiredService for safer DI resolution
- Remove Serilog dependencies in favor of built-in logging
- Use string interpolation in handlers
- Make command classes internal sealed
- HelloWorldInternalBus: switch to async handler, remove custom mapper
- Use Host.CreateApplicationBuilder() instead of CreateDefaultBuilder() - Replace GetService with GetRequiredService for safer DI resolution - Remove Serilog dependencies in favor of built-in logging - Use string interpolation in handlers - Make command classes internal sealed - HelloWorldInternalBus: switch to async handler, remove custom mapper Co-Authored-By: Claude Opus 4.5 <[email protected]>
Pull Request ReviewSummaryThis PR modernizes the CommandProcessor sample applications by adopting current .NET hosting patterns and simplifying dependencies. The changes align well with modern .NET best practices. Positive Changes1. Modern Hosting Patterns
2. Safer Dependency Injection
3. Dependency Simplification
4. Code Quality Improvements
5. HelloWorldInternalBus Improvements
Minor Observations1. Namespace Inconsistency (samples/CommandProcessor/HelloWorldInternalBus/GreetingCommandHandlerAsync.cs:29) The handler is in namespace 2. tests.http Formatting (samples/WebAPI/WebAPI_Dapper/tests.http) The JSON spacing changes are correct and follow standard JSON formatting, though this file seems unrelated to the CommandProcessor samples modernization. Code Quality AssessmentAdherence to Repository Conventions:
Best Practices:
Performance:
Test CoverageNote: These are sample applications demonstrating usage patterns. They do not require unit tests themselves, but they should successfully compile, run without errors, and demonstrate best practices. Recommendation: Verify that each sample builds and runs successfully in CI. Overall AssessmentThis is a high-quality refactoring PR that:
The changes follow the repository design principles by focusing on structural improvements without altering behavior. Recommendation: Approve with minor namespace consistency suggestion. Review generated following repository CLAUDE.md guidelines and design principles. |
iancooper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for updating these @holytshirt
- Fix namespace in HelloWorldInternalBus handler (HelloWorld -> HelloWorldInternalBus) - Rename GreetingCommandRequestHandlerAsync to GreetingCommandHandlerAsync for consistency - Remove ConfigureAwait from samples (application code doesn't need it per Stephen Cleary) - Remove unused using statements Co-Authored-By: Claude Opus 4.5 <[email protected]>
PR Review: Modernise CommandProcessor SamplesOverall AssessmentThis is a well-executed modernization of the sample applications. The changes align with .NET 8 best practices and improve code quality. ✅ Positive Changes1. Modern Host Builder Pattern ✅
2. Safer Dependency Injection ✅
3. Dependency Cleanup ✅
4. Code Quality Improvements ✅
5. Handler Consistency ✅
6. Architecture Simplification ✅
Issues & Concerns1.
|
…tionBuilder - KafkaTaskQueue: Update GreetingsReceiverConsole and GreetingsSender - KafkaSchemaRegistry: Update GreetingsReceiverConsole and GreetingsSender - KafkaDynamicEventStream: Update TaskReceiverConsole and TaskStatusSender - MultiBus: Update GreetingsReceiverConsole and GreetingsSender - HelloWorldInternalBus: Fix GetService -> GetRequiredService Replace Host.CreateDefaultBuilder() with Host.CreateApplicationBuilder() for modern .NET 8+ hosting pattern. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…patterns Convert remaining TaskQueue samples from new HostBuilder() pattern to Host.CreateApplicationBuilder(): - RMQTaskQueue/GreetingsReceiverConsole - ASBTaskQueue/GreetingsReceiverConsole - ASBTaskQueue/GreetingsScopedReceiverConsole - AWSTaskQueue/GreetingsReceiverConsole - AWSTaskQueue/GreetingsPumper - PostgresTaskQueue/GreetingsReceiverConsole - RedisTaskQueue/GreetingsSender - RedisTaskQueue/GreetingsReceiver - MsSqlMessagingGateway/GreetingsReceiverConsole - MsSqlMessagingGateway/CompetingSender - MsSqlMessagingGateway/CompetingReceiverConsole - RMQRequestReply/GreetingsServer Changes applied: - Replace new HostBuilder() with Host.CreateApplicationBuilder(args) - Use top-level statements with builder.Services.Xxx() calls - Remove Serilog configuration in favor of built-in logging - Remove .UseConsoleLifetime() and .UseSerilog() - Keep internal sealed classes for IHostedService implementations - Use GetRequiredService instead of GetService where applicable Co-Authored-By: Claude Opus 4.5 <[email protected]>
Convert JustSaying, MassTransit, and AWS Transformers samples from HostBuilder pattern to Host.CreateApplicationBuilder with top-level statements. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No application code in the PR — skipped Code Health checks.
See analysis details in CodeScene
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
Pull Request Review: Modernize Sample Code to .NET 8 PatternsOverall AssessmentThis is a high-quality PR that successfully modernizes 30+ sample applications to use .NET 8 hosting patterns and best practices. The changes are well-executed and remarkably consistent across the codebase. Overall Grade: A- What This PR Does Well
Issues and RecommendationsHigh Priority - Requires Verification:
Medium Priority - Consider Addressing:
Code Quality AnalysisPattern Consistency: 5/5 - Excellent, same pattern across all samples Security and PerformanceSecurity: No concerns. The switch to GetRequiredService improves null safety. Testing Recommendations
Final RecommendationAPPROVE WITH MINOR VERIFICATION This PR is well-executed and ready to merge after verifying HelloWorldInternalBus functions correctly without the message mapper. The modernization brings the samples up to .NET 8 standards and makes them more accessible to developers learning Brighter. Great work on this comprehensive modernization effort! Review performed by Claude Code - Analyzed 1,158 additions and 1,734 deletions across 39 files |