views:

110

answers:

1

I have a WCF contract with circular references. For a simple parent-child relationship, the solution is pretty simple with .NET 3.5SP1 or greater - the IsReference property of a DataContract (this page has a good explanation).

However, my relationships are three levels deep: grandparent <-> parent <-> child. A "grandparent" has many "parents" and a "parent" has many "children". To get the grandparent <-> parent relationship working, I have IsReference set on the grandparent - no problem. But in order to get the parent <-> child relationship working, "parent" needs to be IsReference as well. As soon as I set that, my service fails - I imagine the problem is that the serializer doesn't know what to do when both the "grandparent" and "parent" are IsReference.

Is there any way to fix this with IsReference or do I ned to pursue a different solution?

A: 

Stupid mistake on my part. The "parent" is an abstract class and I had only tried marking one of it's subclasses with IsReference when I needed to mark the abstract class.

nlawalker