-
Notifications
You must be signed in to change notification settings - Fork 5
ApplyToMethodDeclaration Code Mapping Action
ldfallas edited this page Nov 7, 2015
·
1 revision
<map:ApplyToMethodDeclaration MethodName="methodname">
... inner mapping action ...
</map:ApplyToMethodDeclaration>
Applies a mapping actions to the specified method declaration.
This mapping action can be used with mapping of kind InterfaceImplementation
or ClassInheritance
.
Property | Usage | Description |
---|---|---|
Action | Content property | Mapping action to apply to the method declaration |
MethodName | Required | The name of the method to to apply the mapping action to |
The following example uses the ApplyToMethodDeclaration
to apply the changes required to make a valid implementation of the IValueConverter
interface.
This interface changed in UWP.
<MapUnit xmlns="clr-namespace:Mobilize.Mappers.Extensibility.Core;assembly=Mobilize.ExtensibleMappers"
xmlns:map="clr-namespace:Mobilize.Mappers.Extensibility.Code;assembly=Mobilize.ExtensibleMappers">
<MapUnit.Elements>
<map:CodeMapPackage Type="System.Windows.Data.IValueConverter">
<map:CodeMapPackage.Maps>
<map:CodeMap Kind="Type">
<map:CodeMap.Action>
<map:ReplaceClassUsage NewNamespace="Windows.UI.Xaml.Data" NewClassName="IValueConverter" />
</map:CodeMap.Action>
</map:CodeMap>
<map:CodeMap Kind="InterfaceImplementation">
<map:ActionSequence>
<map:ApplyToMethodDeclaration MethodName="Convert">
<map:ReplaceParameterDeclarationType Position="3">System.String</map:ReplaceParameterDeclarationType>
</map:ApplyToMethodDeclaration>
<map:ApplyToMethodDeclaration MethodName="ConvertBack">
<map:ReplaceParameterDeclarationType Position="3">System.String</map:ReplaceParameterDeclarationType>
</map:ApplyToMethodDeclaration>
</map:ActionSequence>
</map:CodeMap>
</map:CodeMapPackage.Maps>
</map:CodeMapPackage>
</MapUnit.Elements>
</MapUnit>
This mapping action change the signature of the Convert
and ConvertBack
methods.
Contact us for more information
Overview
Writing mappings
Code Mapping Actions
- ActionSequence
- AddHelper
- AddNamespaceImport
- AddPreStatementFromTemplate
- CommentOut
- Conditional
- Keep Code Mapping Action
- MarkAsNotMapped
- RedirectCall
- RedirectCallToInnerMember
- RedirectIndexer
- RedirectProperty
- RemoveCurrentStatement
- RemoveParameter
- ReplaceClassUsage
- ReplaceMethodBodyWithTemplate
- ReplaceParameterDeclarationType
- ReplaceParameterMember
- ReplaceParameterValue
- ReplaceWithMethodCall
- ReplaceWithProperty
- ReplaceWithTemplate
Code Mapping Conditions
- AllConditionsApply
- ArgumentCount
- AssignName
- AssignNameToArgumentRange
- IsExpressionOfType
- IsStringLiteralMatchingRegex
- WithArgument
- WithAssignment
- WithAssignmentLeftSide
- WithAssignmentRightSide
- WithCalledMemberOwner
- WithCalledMethodExpression
- WithConstructorCall
- WithLambdaExpressionBody
- WithLambdaExpressionParameter
- WithLeftSideOfDottedAccess
- WithMemberInitValue
- WithMethodCall
XAML mapping actions
- ActionSequence
- AddStatementToConstructorFromTemplate
- BindPropertyValueElement Xaml mapping action
- ChangeEventHandlerEventArgsType
- CommentOutElement
- CommentOutProperty
- MarkAsNotMapped
- MoveValueToContentProperty
- RemoveNamespaceDeclaration
- RenameElement
- RenameProperty
- ReplaceAttributeValue
- ReplaceEventHandlerBodyWithTemplate
- ReplaceEventHandlerParameterMember
- ReplaceNamespaceDeclaration
- ReplacePropertyValueWithParentResource
- ReplaceStaticResourceWithThemeResource
- SetPropertyValueToComplexElement
- SetPropertyValueToSimpleValue
- WrapContent
XAML mapping conditions
Misc