Content-based Correlation in WF 4 on inherited DataMember property

355 views Asked by At

In Windows Workflow Foundation under .NET 4.0, is there a way to correlate operations based on an inherited data member? For example given the following classes

    [DataContract]
    [KnownType(typeof(DerivedMessage))]
    public abstract class BaseMessage
    {
        [DataMember(Order = 1)]
        public Guid MessageId { get; set; }
    }

    [DataContract]
    public class DerivedMessage : BaseMessage
    {

        [DataMember(Order = 1)]
        public string AdditionalProperty { get; set; }
    }

Shouldn't it be possible to correlate using the property MessageId on an operation accepting an instance of DerivedMessage?

When attempting to use such a property in the CorrelatesOn Definition dialog of a Receive activity in VS2010 the following error is thrown:

Cannot find a path to the member when generating the XPath query.

Am I doing something wrong here? The error message isn't very helpful as I see no reason why it shouldn't be able to generate an XPath query to the MessageId property on the DerivedMessage.

1

There are 1 answers

0
Maurice On BEST ANSWER

The UI is just a helper to generate the relevant XPath query for you. You can always just type it in.