正在验证BizTalk管道组件中的PropertyBag值

正在验证BizTalk管道组件中的PropertyBag值,biztalk,biztalk-pipelines,Biztalk,Biztalk Pipelines,Microsoft在BizTalk管道接口中提供了如下所示的验证组件 以下是我尝试过的,但似乎根本不起作用: public System.Collections.IEnumerator Validate(object projectSystem) { System.Collections.ArrayList errorStringArrayList = new System.Collections.ArrayList(); if (this.Sub

Microsoft在BizTalk管道接口中提供了如下所示的验证组件

以下是我尝试过的,但似乎根本不起作用:

    public System.Collections.IEnumerator Validate(object projectSystem)
    {
        System.Collections.ArrayList errorStringArrayList = new System.Collections.ArrayList();
        if (this.Substring1ColumnStart >= this.Substring1ColumnEnd)
        {
            errorStringArrayList.Add("Substring1ColumnEnd must be > SubstringColumn1Start");
        }
        return (System.Collections.IEnumerator) errorStringArrayList; 
    }
这个医生

“这些错误消息显示为编译器错误消息。要报告 属性验证成功后,该方法应返回空值 统计员。”

但当我输入无效值时,我没有收到任何编译器消息。另外,在BTS Admin中,它不也会进行验证吗?因为BTS Admin没有“编译器消息”

此外,为什么Validate接收一个泛型对象作为parm而不是强类型parm?什么时候调用validate?每次更改propertyBag值时

更新日期:2017年11月5日上午11:55

我尝试了更多的东西,其中两件很难在这里一一列出。 我最终得到了一个错误,但在VS编译错误中不是一个非常有用的错误,请参见下面的屏幕截图。这绝对不是我返回的错误。也许这在VS2015上有问题

我还遇到了一个问题,我修复了我的数据,但仍然得到了错误。由于管道组件是GAC'ed,我每次都关闭并重新打开visualstudio,以确保它得到了新的副本

我在想,可能是返回除null以外的任何内容才是问题所在。 总之,如果在BTS-ADMIN中不起作用,我发现它实际上是无用的。所以我将只做运行时错误。也许这就是为什么很少有关于这个主题的文档和文章/博客

public System.Collections.IEnumerator Validate(object projectSystem)
{

    System.Collections.ArrayList errorStringArrayList = new System.Collections.ArrayList();
    if (this.Substring1ColumnStart >= this.Substring1ColumnEnd)
    {
        errorStringArrayList.Add("Substring1ColumnEnd must be > SubstringColumn1Start");
    }

    if (errorStringArrayList.Count > 0)
    {
        return (System.Collections.IEnumerator)errorStringArrayList;
    }
    else
    {
        return null; 
    }
}

此验证方法仅在管道设计模式下调用。它不会在BTS管理中调用。如果您在“代码”中设置了一些无效值。也不调用此方法

同样的答案来自

[根据记忆,但我93%确定这就是它的工作原理…]

visualstudio在生成时调用Validate,可能在每次属性分配之后都会调用Validate

如果返回非0集合,并且设计图面上的组件将具有红色轮廓,则项目将不会生成

IIRC,您只需直接验证属性值,但需要这样做。IPropertyBag.Write已被调用,您在那里编写的代码应该已经设置了属性


基本上,如果(MyComponent.MySpecialValue!=“B”){ErrorStringArray.Add(“噢,不!”);}

谢谢,那么在BTSAdmin中是否还有任何要验证的内容?其他方法,或者根本不可能?为什么我在Visual Studio中放置