Phase 1: Replace GenericServices with Custom Services, MediatR, and FluentValidation #10
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.
Summary
This PR implements Phase 1 of the migration plan to replace GenericServices (not .NET Core compatible) with a modern architecture. It adds a new
SampleWebApp.Core.NET Standard 2.0 project containing:BaseDto,BaseQuery<T>,BaseCommand<T>for consistent patternsOperationResult,CreateResult,UpdateResult,DeleteResult,PagedResult<T>, andISuccessOrErrorsfor backward compatibilityPostDto,SimplePostDto,TagDto,BlogDtowith validation attributesIListService,IDetailService,ICreateService,IUpdateService,IDeleteService) and domain-specific (IPostService,ITagService,IBlogService)PostValidator,TagValidator,BlogValidatorGenericServicesAdapterto bridge new MediatR-based services with existing controller patternsServiceCollectionExtensions.AddCoreServices()Note: Package versions were adjusted from the spec to maintain .NET Standard 2.0 compatibility:
Review & Testing Checklist for Human
IPostRepository,ITagRepository,IBlogRepository) returnobjecttypes since the Core project doesn't reference DataLayer. Verify this approach works for Phase 2 integration.dotnet buildbut should be verified in CI.Recommended test plan: Since this is Phase 1 (infrastructure only), verify the project builds successfully. Actual runtime testing will occur in Phase 2 when controllers are updated to use the new services.
Notes
Link to Devin run: https://app.devin.ai/sessions/b5a358f889ca47dc810452db58b86c5d
Requested by: Abhay Aggarwal (abhay.aggarwal@cognition.ai) / @abhay-codeium