【问题标题】:BizTalk - how to programmatically call the Visual Studio validate map and save the XSLTBizTalk - 如何以编程方式调用 Visual Studio 验证映射并保存 XSLT
【发布时间】:2018-07-05 20:41:15
【问题描述】:

在 Visual Studio 中,我可以右键单击地图(.btm 文件)并为一张地图手动选择“验证地图”。然后我可以单击并查看 XSLT。

有没有办法调用这个函数?我想将大约 150 个地图转换为 XSLT 以进行分析和比较它们的相似/不同之处。

【问题讨论】:

  • 应该是可能的,因为在编译的DLL中它们是XSLT版本而不是.btm,所以你应该能够使用反射来提取xslt字符串。根据stackoverflow.com/questions/20877720/…,在源代码丢失的情况下,我已经手动完成了

标签: xslt biztalk biztalk-2013


【解决方案1】:

您可以像这样从编排中动态加载和调用地图:

// 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);

这是获取地图对象类型的示例。我把我的放在一个 C# 助手程序集中。

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;
}

【讨论】:

  • 谢谢,我现在正在处理其他事情;当我回到这个会尝试标记为答案。
  • 嗨,又在看这个了。您的答案在哪里谈到获取地图的 XSLT?我正在尝试从 C# 或 Powershell 执行此操作,而不是编排。但我也有兴趣从 C# 运行地图。
  • 对不起,我看错了你的问题。我看到了“如何以编程方式调用地图”
猜你喜欢
  • 2017-04-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多