Skip to content

Automatic Nested Mapping SupportΒ #1

Description

@talehkarimov

πŸ“ Description

Implement automatic nested mapping support in CleanMapper to map complex object graphs without requiring manual mapping calls for each nested property or collection.

βœ… Acceptance Criteria

  • When mapping a class that contains nested class properties, CleanMapper automatically maps those nested objects if mappings exist for their types.
  • When mapping a class that contains collections of nested objects (e.g. List), CleanMapper automatically maps each item if mappings exist for their element types.
  • The feature respects existing configured mappings and throws a clear exception if a nested mapping is missing.
  • Unit tests cover
    • Nested object mapping
    • Collections of nested objects mapping
    • Scenarios with missing nested mappings

πŸ”§ Implementation Notes

  • Extend MappingConfiguration.CreateMap to:
    • Detect destination properties that are complex types or collections.
    • For complex types, call existing mappings recursively.
    • For collections, generate mapping expressions for each item.
  • Ensure no runtime reflection is used during mapping execution.

⚠️ Potential Challenges

  • Handling cyclical references (to avoid infinite recursion).
  • Distinguishing between primitive types, strings, collections, and complex classes during expression tree generation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv1.1.0Version 1.1.0

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions