Thursday, 15 May 2008

Workflow Send activity + WCF [DataMember] and the story of why I am an idiot!!!

If you have a class BusinessCaseContentType whose properties are not decorated with the [DataMember] attribute and you try and use a Workflow SendActivity to receive this class BusinessCaseContentType it will always come back un-populated.

using System;
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace Acres.DataContracts
  public class BusinessCaseContentType

  private string _BusinessCaseType;

   [DataMember] // - not my friend at the moment
  public string BusinessCaseType
    get { return _BusinessCaseType; }
    set { _BusinessCaseType = value; }


Thing is, you wont get an error you will just get a NULL instance of BusinessCaseContentType.

Now this really sucks as I spent 2 days looking a for a needle in a haystack when in fact I was looking for a tractor in a haystack!!

Oh well, at least I know for next time!!

Can I have a beer please!!