Frage

ist es möglich, eine benutzerdefinierte Fehlermeldung auf einen ThrowActivity zu werfen, in Windows Workflow Foundation?

zB. Stellen Sie sich vor ich will diese Ausnahme werfen, in meiner WF: -

CutomException("This is my custom error message", myNumber, myObect);

cheers:)

War es hilfreich?

Lösung

Vielleicht verstehe ich Ihre Frage nicht gut, aber man kann die spezifische Ausnahme mit der Fault Eigenschaft ThrowActivity an jedem Ort vor der Aktivitätsausführung gesetzt, z.

throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);

Andere Tipps

Sie können eine beliebige benutzerdefinierte Ausnahme wie auf diese Weise werfen.

public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException ();

[SerializableAttribute ()]     public class DiscontinuedProductException: Ausnahme     {         public DiscontinuedProductException ()             : Base ()         {         }

    public DiscontinuedProductException(string message)
        : base(message)
    {
    }

    public DiscontinuedProductException(string message, Exception innerException)
        : base(message, innerException)
    {
    }

    protected DiscontinuedProductException(SerializationInfo info, StreamingContext context)
        : base(info, context)
    {
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top