-
Notifications
You must be signed in to change notification settings - Fork 5
ReplaceClassUsage Code Mapping Action
ldfallas edited this page Sep 11, 2015
·
4 revisions
<map:ReplaceClassUsage NewNamespace="NEW-NAMESPACE" NewClassName="NEW-CLASS-NAME" />Also, for renames that include generic parameters:
<map:ReplaceClassUsage NewNamespace="NEW-NAMESPACE" NewClassName="NEW-CLASS-NAME" >
<map:ReplaceClassUsage.NewTypeArguments>
...
<map:TypeArgument>TYPE-ARGUMENT-NAME</map:TypeArgument>
...
</map:ReplaceClassUsage.NewTypeArguments>
</map:ReplaceClassUsage>Replaces a class name reference with another class name.
| Property | Usage | Description |
|---|---|---|
| NewNamespace | Required | The namespace name of the target class |
| NewClassName | Required | The simple class name of the target class |
| NewTypeArguments | Optional | A list of type argument to generate for this type |
We want to convert from System.Device.Location.GeoCoordinate to Windows.Devices.Geolocation.GeoPoint .
We want to convert from this code:
-- Windows Phone 8 Silverlight --
public double RetrieveLatitude(GeoCoordinate c)
{
...
}To the following code:
public double RetrieveLatitude(Windows.Devices.Geolocation.Geopoint c)
{
...
}We change use the ReplaceClassUsage mapping action to perform this change:
<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.Device.Location.GeoCoordinate">
<map:CodeMapPackage.Maps>
<map:CodeMap Kind="Type">
<map:CodeMap.Action>
<map:ReplaceClassUsage NewNamespace="Windows.Devices.Geolocation" NewClassName="Geopoint" />
</map:CodeMap.Action>
</map:CodeMap>
...
</map:CodeMapPackage.Maps>
</map:CodeMapPackage>
</MapUnit.Elements>
</MapUnit>- This mapping action can only be used in a
CodeMapof kindType
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