Phase 1: Replace GenericServices with Custom Services, MediatR, and FluentValidation#10
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Conversation
…, and custom services This commit implements Phase 1 of the migration plan to replace GenericServices with a modern, .NET Core-compatible architecture: - Created SampleWebApp.Core .NET Standard 2.0 project - Added MediatR 9.0.0, AutoMapper 10.1.1, FluentValidation 10.4.0 - Implemented base classes (BaseDto, BaseQuery, BaseCommand) - Created result types (CreateResult, UpdateResult, DeleteResult, PagedResult, SuccessOrErrors) - Migrated DTOs (PostDto, SimplePostDto, TagDto, BlogDto) - Created service interfaces (IListService, IDetailService, ICreateService, IUpdateService, IDeleteService) - Created domain-specific service interfaces (IPostService, ITagService, IBlogService) - Implemented MediatR queries and commands for Posts, Tags, and Blogs - Implemented service classes (PostService, TagService, BlogService) - Implemented MediatR handlers for all queries and commands - Added FluentValidation validators (PostValidator, TagValidator, BlogValidator) - Created AutoMapper profiles for entity-to-DTO mapping - Created anti-corruption layer (GenericServicesAdapter) - Configured dependency injection (ServiceCollectionExtensions) Co-Authored-By: Abhay Aggarwal <abhay.aggarwal@codeium.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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