是否可以在Windows工作流基礎中向ThrowActivity引發自定義錯誤消息?WF ThrowActivities和自定義錯誤消息?
例如。想象一下,我想拋出此異常,在我的WF: -
CutomException("This is my custom error message", myNumber, myObect);
歡呼:)
是否可以在Windows工作流基礎中向ThrowActivity引發自定義錯誤消息?WF ThrowActivities和自定義錯誤消息?
例如。想象一下,我想拋出此異常,在我的WF: -
CutomException("This is my custom error message", myNumber, myObect);
歡呼:)
也許我不明白你的問題很好,但你可以在ThrowActivity
的Fault
屬性設置特定異常活動執行前的任何地方,例如:
throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);
您可以像這樣拋出任何自定義異常。
public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException();
[SerializableAttribute()] 公共類DiscontinuedProductException:異常 { 公共DiscontinuedProductException() :鹼() { }
public DiscontinuedProductException(string message)
: base(message)
{
}
public DiscontinuedProductException(string message, Exception innerException)
: base(message, innerException)
{
}
protected DiscontinuedProductException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
是的!完善!我無法弄清楚如何在設計器中做到這一點..所以我在後面的代碼中做到了。再次檢查設計師,它仍然沒有感覺:P,但沒關係:) – 2008-11-14 00:09:10