I am trying to persist a workflow that has a EF POCO in it as a variable. When I try to persist (and workflow is trying to serialize the object), I get an error:
Type ‘System.Collections.Generic.ICollection`1[MyObject]’ cannot be
serialized. Consider marking it with the DataContractAttribute
attribute, and marking all of its members you want serialized with the
DataMemberAttribute attribute. If the type is a collection, consider
marking it with the CollectionDataContractAttribute. See the
Microsoft .NET Framework documentation for other supported types.
Any ideas how to get around this?
I found the answer here:
Get serialization error when try and submit EF4 entity via WCF
It turns out the FixupCollection (in Entities.tt) does not have the DataContract attribute. Once I added that, the issue was resolved.