Skip to content

Conversation

@devin-ai-integration
Copy link

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:

  • Base classes: BaseDto, BaseQuery<T>, BaseCommand<T> for consistent patterns
  • Result types: OperationResult, CreateResult, UpdateResult, DeleteResult, PagedResult<T>, and ISuccessOrErrors for backward compatibility
  • DTOs: PostDto, SimplePostDto, TagDto, BlogDto with validation attributes
  • Service interfaces: Generic (IListService, IDetailService, ICreateService, IUpdateService, IDeleteService) and domain-specific (IPostService, ITagService, IBlogService)
  • MediatR handlers: Full CQRS implementation for Posts, Tags, and Blogs
  • FluentValidation validators: PostValidator, TagValidator, BlogValidator
  • Anti-corruption layer: GenericServicesAdapter to bridge new MediatR-based services with existing controller patterns
  • DI configuration: ServiceCollectionExtensions.AddCoreServices()

Note: Package versions were adjusted from the spec to maintain .NET Standard 2.0 compatibility:

  • MediatR: 10.0.1 → 9.0.0
  • AutoMapper: 11.0.1 → 10.1.1
  • FluentValidation: 11.1.0 → 10.4.0

Review & Testing Checklist for Human

  • Verify package version changes are acceptable - The specified versions (MediatR 10.0.1, AutoMapper 11.0.1) require .NET Standard 2.1, so I downgraded to versions compatible with .NET Standard 2.0. Confirm this is acceptable for the migration path.
  • Review repository interface design - Repository interfaces (IPostRepository, ITagRepository, IBlogRepository) return object types since the Core project doesn't reference DataLayer. Verify this approach works for Phase 2 integration.
  • Validate business rules in PostValidator - Contains rules like "no ! in title", "can't end with ?", "can't mention sheep/lamb/cow/calf". Verify these match existing GenericServices validation behavior.
  • Confirm GenericServicesAdapter scope - Currently only covers Post operations. Verify if Tag/Blog adapter methods are needed for Phase 2.
  • Test build in CI - The project compiles locally with dotnet build but 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

  • This PR does NOT modify existing controllers or views - that's Phase 2
  • The existing GenericServices code remains untouched for gradual migration
  • Runtime testing requires Windows/LocalDB which isn't available in this environment

Link to Devin run: https://app.devin.ai/sessions/b5a358f889ca47dc810452db58b86c5d
Requested by: Abhay Aggarwal (abhay.aggarwal@cognition.ai) / @abhay-codeium

…, 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>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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