NealWalters
NealWalters

Reputation: 18227

BizTalk - how to programmatically call the Visual Studio validate map and save the XSLT

In Visual Studio, I can right click a map (.btm file) and select "Validate Map" manually for one map. Then I can click and see the XSLT.

Is there a way to call this function? I would like to turn about 150 maps into XSLT for analysis and comparing how similar/different they are.

Upvotes: 2

Views: 291

Answers (1)

Jay
Jay

Reputation: 14481

You can dynamically load and call maps from an orchestration like so:

// dynamicMapType is declared 'System.Type'
dynamicMapType = Helper.GetMapType(MessageTypeName);
// Call the transform given by the object type, pass in a message
transform(msgOut) = dynamicMapType(msgIn);

Here's an example to get a map object type. I put mine in a C# helper assembly.

public static System.Type GetMapType(string MessageType)
{
    System.Type typ = null;
    switch (MessageType.ToUpper())
    {
        case "ONE":
            typ = System.Type.GetType("AssemblyQualifiedName_from_gacutil");
            break;
        default:
            throw new SystemException("Could not determine map transform type '" + MessageType + "'");
    }
    if (typ == null)
        throw new SystemException("Could not load map transform type '" + MessageType + "'");
    return typ;
}

Upvotes: 1

Related Questions