BizTalk BRE - .Net Class 中的方法在 Orchestration Call Rule Shape 中不起作用

BizTalk BRE - Method in .Net Class not working in Orchestration Call Rule Shape

我正在尝试使用外部 class 库方法调用 AddValidationErrors 来消除 Business Rule Composer 中的数据验证错误。我创建了一个 FactCreator class,它也实现了 IFactCreator 接口。当我尝试在 Business Rule Composer 中测试我的策略时,这是有效的。但是当我在 Orchestration 中尝试时,它的规则没有被触发。谁能帮我解决这个问题。下面是我的验证错误代码

public void AddValidationError(TypedXmlDocument activeDoc, string err)
{
   XmlDocument doc = activeDoc.Document.OwnerDocument;
   XmlNode errorRoot = doc.SelectSingleNode("//ValidationErrors");
   XmlElement newError = doc.CreateElement("Error");
   newError.InnerText = err;
   errorRoot.AppendChild(newError);
}

事实创造者Class:

    private object[] objs;

    public FactCreator()
    {

    }
    public object[] CreateFacts(RuleSetInfo ruleSetInfo)
    {
        objs = new object[1];
        objs[0] = new ValidationErrors.ValidationErrors();
        return (objs);
    }

    public Type[] GetFactTypes(RuleSetInfo ruleSetInfo)
    {
        return null;
    }

您是否为 .NET 启用了 BRE 静态支持?

要为静态 .Net 方法启用 BRE 支持这些方法,请将名为 StaticSupportREG_DWORD 键添加到以下注册表路径,值为 1

32 位 Windows

HKEY_LOCAL_MACHINE\Software\Microsoft\BusinessRules.0\

64 位 Windows

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\BusinessRules.0\

这是一次性的 activity。

以上信息来自this博客

MSDN 提取添加:

Another option is to put StaticSupport in the BTNTsvc[64].exe.config file, as any settings here override what's in the Registry. Further, one can also make the argument that this option is preferred since it isolates the change in default behavior to BizTalk only, whereas Registry settings are global to the Operating System.