dexter
dexter

Reputation: 7213

WCF - Preserving Object References in WCF (IIS Hosted)

I am getting the

'Object graph for type 'MyCompany.MyEntity' contains cycles and cannot be serialized if reference tracking is disabled.'. Please see InnerException for more details.

when calling the service with an object that contains references to other object (those are essentially linq to sql entities).

I am reading this which explains how to enable preserving references for this case in the self hoseted service environment: http://blogs.msdn.com/b/sowmy/archive/2006/03/26/561188.aspx

However, my service has to be hosted on IIS. How to enable the service to serialize the entites correctly?

Upvotes: 0

Views: 344

Answers (1)

dexter
dexter

Reputation: 7213

It's even easier than I thought and certainly easier what's in the article: I just used this [DataContract(IsReference=true)] to fix the issue.

Upvotes: 1

Related Questions