Skip to content

RedirectCall Code Action

ldfallas edited this page Aug 31, 2015 · 3 revisions

Description

Changes the method to be called for a given method call.

This action can be used to change calls for A.SourceMethod() to A.TargetMethod() .

Properties

Property Usage Description
NewMethod Required The name of the new method to be called
NewMethodOwner Optional An optional name for the new method owner
AddAwait Optional If set to True an await keyword will be added to the target method call.

Example

Say that we want to replace the System.Net.WebResponse.Close method calls to call to the Dispose method.

The mapping for this scenario looks like this;

<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.Net.WebResponse" >
      <map:CodeMapPackage.Maps>
        <map:CodeMap Kind="Call" MemberName="Close">
          <map:CodeMap.Action>
            <map:RedirectCall NewMethod="Dispose" />
          </map:CodeMap.Action>
        </map:CodeMap>
      </map:CodeMapPackage.Maps>
    </map:CodeMapPackage>
  </MapUnit.Elements>
</MapUnit>

Notes

TODO

Overview

Writing mappings

Code Mapping Actions

Code Mapping Conditions

XAML mapping actions

XAML mapping conditions

Misc

Clone this wiki locally