Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC Additional parameter mapping #550

Closed
wants to merge 10 commits into from

Conversation

TimothyMakkison
Copy link
Collaborator

@TimothyMakkison TimothyMakkison commented Jul 8, 2023

POC Additional parameter mapping

Description

Working POC for additional parameters mapping.

  • Supports additonal parameter for A -> B mappings
  • Maps to properties only (no constroctor mapping rn)
  • Only passes parameters down when needed, even if the method is recursive or doesn't directly use the parameter
  • Support IReferenceHandler, this loigic could be used on to only pass IReferenceHandler to methods that use it

Changes:

  • NewInstanceObjectMemberMappingBodyBuilder checks for matching additional parameters after trying the source value.
  • IMapping has a Parameters property
  • MappingBuilder checks for if a mapping is being built (prevents infinite loop), adding it to MappingCollection.Incomplete
    • MappingBodyBuilder.BuildBody this way NewInstanceObjectMemberMappingBodyBuilder is called early to see which parameters are used in its property mappings
    • MappingBuilderContext tracks which parameters have been used when creating a building the mapping. These are used by MappingBuilder to update which parameters were used for a given mapping.
    • Mappings which don't use extra paramerers are added to MappingCollection._mappings otherwise they are added to MappingCollection._scopedMappings
  • MappingCollection._scopedMappings are limited for use by the UserDefinedMapping that created it. This prevents resolving/config issues.

Fixes #103

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.

Supply additional parameters to the mapping method
1 participant