Skip to content

RedirectIndexer Code Mapping Action

ldfallas edited this page Aug 31, 2015 · 3 revisions

Usage

<map:RedirectIndexer ToProperty="PROPERTY-NAME" />

Description

Replaces references to an indexer property with an indexer of an inner property.

For example it can change from A["X"] to A.B["X"] .

Properties

​Property ​Usage ​Description
ToProperty Required Indicates the name of the inner property to redirect the call to

Example

Say that we want to replace the System.IO.IsolatedStorage.IsolatedStorageSettings[] method calls to call to the Windows.Storage.ApplicationDataContainer.Values[] indexer.

The mapping for this scenario looks like this;

<?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.IsolatedStorageSettings">
      <map:CodeMapPackage.Maps>
        ...
        <map:CodeMap Kind="ElementAccess">
          <map:CodeMap.Action>
            <map:RedirectIndexer ToProperty="Values" />
          </map:CodeMap.Action>
        </map:CodeMap>
        ...
      </map:CodeMapPackage.Maps>
     </map:CodeMapPackage>
  </MapUnit.Elements>
</MapUnit>

Notes

  • This mapping action only works on CodeMaps of kind ElementAccess.

Overview

Writing mappings

Code Mapping Actions

Code Mapping Conditions

XAML mapping actions

XAML mapping conditions

Misc

Clone this wiki locally