Phase 1: Replace GenericServices with Custom Services, MediatR, and FluentValidation #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Phase 1: Replace GenericServices with Custom Services, MediatR, and FluentValidation
Summary
This PR implements Phase 1 of the migration plan to replace GenericServices (v1.0.9, not .NET Core compatible) with a modern architecture. A new
SampleWebApp.Core.NET Standard 2.0 project has been created containing:Package versions were adjusted for .NET Standard 2.0 compatibility: MediatR 9.0.0, AutoMapper 10.1.1, FluentValidation 10.4.0.
Review & Testing Checklist for Human
IDbContextAdapter pattern review: Services depend on
IDbContextAdapterinterface with entity types (PostEntity, TagEntity, BlogEntity) defined in the Core project. No implementation exists yet - this is intentional to avoid DataLayer coupling. Verify this approach is acceptable for Phase 2 integration.DTO structure validation: DTOs have both
Id(from BaseDto) and entity-specific IDs (PostId, TagId, BlogId). Confirm this dual-ID pattern won't cause issues when mapping to/from existing ServiceLayer DTOs.Validator logic review: PostValidator includes business rules (no "!" in title, no "sheep/lamb/cow/calf" in content) copied from existing code. Verify these match current validation requirements.
GenericServicesAdapter completeness: Currently only implements Post operations. Confirm whether Tag/Blog adapter methods are needed for Phase 1.
Build verification: Run
dotnet build SampleWebApp.Core/SampleWebApp.Core.csprojto confirm compilation succeeds.Recommended test plan: Since this is Phase 1 (infrastructure only), functional testing requires Phase 2 implementation. For now, verify the project builds and review the code structure matches the specification document.
Notes
Link to Devin run: https://app.devin.ai/sessions/7a2a40985384430e85b04122e904bb90
Requested by: Abhay Aggarwal (abhay.aggarwal@cognition.ai) / @abhay-codeium