-
Notifications
You must be signed in to change notification settings - Fork 5
WithCalledMethodExpression Code Mapping Condition
ldfallas edited this page Aug 31, 2015
·
3 revisions
Tests conditions against the method reference expression of a method call expression.
This means that for a.Foo()
the inner condicitions will be tested againt the a.Foo
expression.
Property | Usage | Description |
---|---|---|
SubCondition | Required/Content property | The conditions to test on the left side of the invoked member owner. |
In this case we want to capture the left side of the expression being called. Here's an example of using this mapping action in conjuction with AssignName
and WithLeftSideOfDottedAccess
.
<?xml version="1.0" encoding="utf-8" ?>
<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.IO.IsolatedStorage.IsolatedStorageFile">
<map:CodeMapPackage.Maps>
...
<map:CodeMap Kind="Call" MemberName="OpenFile">
<map:Conditional>
<!-- Open file for read case (discrimated by mode) -->
<map:Case>
<map:Case.Condition>
<map:WithMethodCall>
<map:ArgumentCount>2</map:ArgumentCount>
<map:WithArgument Position="0">
<map:AssignName>$fileNameExpression</map:AssignName>
</map:WithArgument>
<map:WithArgument Position="1">
<map:Equals>FileMode.Open</map:Equals>
</map:WithArgument>
<map:WithCalledMethodExpression>
<map:WithLeftSideOfDottedAccess>
<map:AssignName>$folderReference</map:AssignName>
</map:WithLeftSideOfDottedAccess>
</map:WithCalledMethodExpression>
</map:WithMethodCall>
</map:Case.Condition>
<map:Case.Action>
<map:ReplaceWithTemplate>
await $folderReference.OpenStreamForReadAsync($fileNameExpression)
</map:ReplaceWithTemplate>
</map:Case.Action>
</map:Case>
...
</map:Conditional>
</map:CodeMap>
</map:CodeMapPackage.Maps>
...
</map:CodeMapPackage>
</MapUnit.Elements>
</MapUnit>
- This condition succeeds if its inner conditions succeed.
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