Component Element Customizer Missing ability to map non-public parents and composite element relations

Description

We have found a need within our code to be able to map non-public parents and composite element relations. Methods with a string parameter notVisiblePropertyOrFieldName are available on other customizers but not on the ComponentElementCustomizer class.

The proposed change would add the following interface methods:

  • Line 20: IComponentElementMapper<TComponent> interface, insert the following code:

void Property(string notVisiblePropertyOrFieldName, Action<IPropertyMapper> mapping);
  • IComponentMapper.cs, line 24, IComponentsAttributeMapper<TComponent> interface, insert the following code:

void Parent(string notVisiblePropertyOrFieldName, Action<IComponentParentMapper> mapping);

Proposed implementation for first of them:

  • In ComponentElementCustomizer.cs, line 70, insert the following code:

public void Property(string notVisiblePropertyOrFieldName, Action<IPropertyMapper> mapping) { MemberInfo member = GetPropertyOrFieldMatchingNameOrThrow(notVisiblePropertyOrFieldName); MemberInfo memberOf = member.GetMemberFromReflectedType(typeof(TComponent)); _customizersHolder.AddCustomizer(new PropertyPath(_propertyPath, member), mapping); _explicitDeclarationsHolder.AddAsProperty(memberOf); }

Environment

None

Activity

Show:

Alex Zaytsev 
April 28, 2017 at 2:56 AM
(edited)

Actually, after some investigation, I think, that ICompnentElement* should not exist. And should be replaced by IComponent*

Alex Zaytsev 
April 28, 2017 at 2:45 AM

, yes

byrona 
April 28, 2017 at 1:14 AM
(edited)

I assume that the non-generic IComponentElementMapper should also extend the non-generic IMinimalPlainPropertyContainerMapper?

Alex Zaytsev 
April 27, 2017 at 10:00 PM

I think that IComponentElementMapper<TComponent> shall extend IMinimalPlainPropertyContainerMapper<TComponent> interface. The overriden properties then shall be removed from IComponentElementMapper<TComponent>.

ComponentElementCustomizer does not have GetPropertyOrFieldMatchingNameOrThrow method, so it shall be added/shared with other class.

Frédéric Delaporte 
April 27, 2017 at 4:26 PM
(edited)

You may submit a PR, see contributing guideline.

Edit: Well you just done it for another Jira indeed^^.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 27, 2017 at 5:37 AM
Updated May 2, 2017 at 9:57 AM
Resolved May 2, 2017 at 9:57 AM
Who's Looking?