Skip to content

refactor: remove AutoMapper and replace with manual mapping due to licensing changes#1321

Closed
Kamyab7 wants to merge 2 commits intojasontaylordev:mainfrom
Kamyab7:remove-auto-mapper
Closed

refactor: remove AutoMapper and replace with manual mapping due to licensing changes#1321
Kamyab7 wants to merge 2 commits intojasontaylordev:mainfrom
Kamyab7:remove-auto-mapper

Conversation

@Kamyab7
Copy link
Copy Markdown
Contributor

@Kamyab7 Kamyab7 commented Apr 19, 2025

This PR removes AutoMapper from the application and replaces all usages with manual mapping functions.

🚨 Why?

AutoMapper has recently adopted a commercial license for production use. To avoid potential licensing issues and to keep the project open and dependency-light, this change removes AutoMapper entirely.

✅ Changes:

  • Removed AutoMapper library and DI configuration
  • Replaced ProjectTo<T>(), .Map() calls, and Profile classes with explicit mapping functions
  • Added static mappers for:
    • TodoItemBriefDto
    • TodoItemDto
    • TodoListDto
    • LookupDto
  • Updated query handlers and mapping extensions to support Func<TSource, TDestination>
  • Simplified the mapping logic, making it more transparent and maintainable

🧩 Dependency:

This PR depends on #1320, as it introduces the Shouldly library used in tests.

📚 Housekeeping:

  • Removed AutoMapper from the list of dependencies in the README

🔒 Closes: #1206

Kamyab7 added 2 commits April 19, 2025 15:04
- Migrated all test assertions from FluentAssertions to Shouldly
- Removed all FluentAssertions package references
- Updated README to reflect use of Shouldly
- Removed AutoMapper configuration and usages
- Introduced manual mapping methods for DTOs (e.g., TodoItemDto, TodoListDto, LookupDto)
- Updated extension methods to support manual mapping (PaginatedListAsync, ProjectToListAsync)
- Refactored query handlers to use manual mappers instead of ProjectTo<T>
- Updated unit tests to reflect manual mapping and use Shouldly for assertions
- Removed AutoMapper from the list of libraries in the README
@Kamyab7 Kamyab7 marked this pull request as ready for review April 19, 2025 12:43
@juanmarquezruiz
Copy link
Copy Markdown

With all due respect, I believe the best decision would have been to support ourselves with other libraries that are aiming to stand out in light of this potential situation with AutoMapper. There are some well-regarded alternatives, and it would have required even less refactoring. Additionally, our friend Jimmy Bogard communicated that the current versions can still be used, but maintenance is not a priority for them.

@jasontaylordev
Copy link
Copy Markdown
Owner

Thank you for your contribution, however I'm going to continue using both AutoMapper and MediatR for the time being.

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.

3 participants